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