rfind() string method in Python

The rfind() is a built-in string method returns the highest index (last occurrence).

Syntax string.rfind(substring, start, end)

Example:

Python

text = "python programming"
print(text.rfind("m"))    # Output: 14

Special Note: Returns -1 if substring is not found.