Important Notice:

Course Content
The Calendar Module
Library Function/Predefined Functions
0/4
Sys Module
Library Function/Predefined Functions
0/2
OS Module
Library Function/Predefined Functions
0/2
Functions in Python (Chapter-10) M3-R5
About Lesson

rfind():-

            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. See example below.

Syntax:-                       string.rfind(value, start, end)

txt = “Hello, welcome to my world.”

x = txt.rfind(“e”)

print(x)                

# 13

txt = “Hello, welcome to my world.”

x = txt.rfind(“e”, 5, 10)

print(x)                                

# 8

txt = “Hello, welcome to my world.”

print(txt.rfind(“q”))    # -1

print(txt.rindex(“q”))     #  valueError

error: Content is protected !!