Python String endswith() method

The string.endswith() method in Python returns a Boolean value True if the string ends with the specified suffix, otherwise it returns False.

Syntax

Parameter

suffix – This parameter represents a string or tuple of suffixes to be checked.

start (optional) – This parameter signifies the beginning position where suffix is to be checked within the string.

end (optional) – This parameter signifies the ending position where suffix is to be checked within the string.

Return

The method returns a Boolean value True if the strings ends with the specified suffix else it returns False if the string doesn’t end with the specified suffix.

Example 1

Output

Example 2

Output

Pin It on Pinterest

Share This