Python - String Method - endswith() Tutorial
It will return a boolean value, i.e True if the string ends with the specified value, otherwise it will return False.
Syntax-
String.endswith(value, start, end)
#value - It is a suffix(end value) that
needs to be checked in the given String.
#start - (Optional) It is a position to start
the search, by default,it is 0
#end - (Optional) It is a position to end search,
by default is the end of the string
Example-
str1 = "Hello Python"
print(str1.endswith("on"))
print(str1.endswith("Py",0,8))
print(str1.endswith("Hell"))
Output-
True
True
False