The string. rfind() method in Python returns the highest index in the string if the substring sub is found else it returns -1 if the substring is not found.

Syntax

Parameter

sub: This parameter represents the value to search for.

start( Optional): This parameter signifies the substring from where the search is to start and its

default value is 0.

end: This parameter signifies the substring from where to end the search and its default value is

the end of the string.

Return

This method returns the highest index in the string is the substring sub is found else it returns -1 if the substring is not found. 

Example 1

Output

Example 2

Output

Example 3

Output

Pin It on Pinterest

Share This