Home >>Python String Methods >Python String endswith() Method
Python string endswith() method is used to return true if the string ends with the specified value otherwise it will return false.
Syntax:string.endswith(value, start, end)
Parameter | Description |
---|---|
value | This is a required parameter. It defines the value to check if the string ends with. |
start | This is an optional parameter. It defines an Integer specifying at which position to start the search. |
end | This is an optional parameter. It defines an Integer specifying at which position to end the search. |
txt = "Welcome to PHPTPOINT!!"
x = txt.endswith("!")
print(x)
txt = "Welcome to PHPTPOINT!!"
x = txt.endswith("POINT!!", 5, 11)
print(x)