Check the start or end of a string
Use startswith() or endswith() for strings
Are you familiar with the .startswith( )
and .endswith( )
methods for strings?
These built-in Python functions function similarly to MS Excel’s function “MID”.
Its syntax is simple, requiring only to input the string to be checked and it has optional start and end points of the verification in the text.
The return is a Boolean value: True or False.
my_str.startswith( ‘string’, start, end )