Python String Rfind() Method

Python String Rfind() Method

  • The rfind() method finds the last occurrence of the specified value.

  • The rfind() method returns -1 if the value is not found.

  • The rfind() method is almost the same as the rindex() method.

Syntax

                              string.rfind(sub, start, end) 

Parameter Values                                                         

  • sub                It’s the sub string which needs to be searched in the given string.

  • start              Starting position where sub is needs to be checked within the string.

  • end                Ending position where suffix is needs to be checked within the string.

 

 

Comments