endswith() String Method in Python with Examples
endswith()
method returns True
if string ends with the specified suffix, otherwise it returns False
.
Example: endswith() String Method
message = 'Welcome to Python!'
print(message.endswith('on!'))
print(message.endswith('on'))
Output
True False
Related String Methods