Python String startswith() method

The string.startswith() method in Python returns a boolean value ‘True’ if the given string starts with the prefix, otherwise it returns False.

Syntax

Parameter

prefix: This parameter signifies the value to check.

start(optional): This parameter represents an Integer specifying at which position to start the search.

end(optional): This parameter an Integer specifying at which position to end the search.

Return

This method returns a boolean value ‘True’ if the given string starts with the prefix, otherwise it returns False.

Example 1

Output

Example 2

Output

Pin It on Pinterest

Share This