Python str.startswith() Method
The startswith() method returns True if the string starts with the
specified value, otherwise False.
Syntax
string.startswith(value, start, end)
Parameters
| Parameter | Description |
|---|---|
value |
Required. The value to check if the string starts with. Can be a string or a tuple of strings |
start |
Optional. An integer specifying at which position to start the search |
end |
Optional. An integer specifying at which position to end the search |
Return Value
Boolean. True if found, otherwise False.
Example
Using the startswith() method:
Output
Click Run to execute your code
Enjoying these tutorials?