Python String Startswith() Method

Python String Startswith() Method

  • Python string startswith( ) function returns True if the string starts with the given prefix, otherwise it returns False.

Syntax

                                str.startswith(prefix[, start[, end]])

Parameter

  • The prefix can be a string or a tuple of string prefixes to look for in the string. 

  • The start is an optional argument to specify the index from where test starts.

  • The end is an optional argument to specify the index where the test has to stop.

 

 

 

Comments