- rindex
rindex in string with range
examples/strings/rindex.py
text = "The black cat climbed the green tree." print(text.rindex("c")) # 14 print(text.rindex("c", 8)) # 14 print(text.rindex("c", 8, 13)) # 10 print(text.rindex("gr", 8)) # 26 print(text.rindex("gr", 8, 16))
14 14 10 26 Traceback (most recent call last): File "examples/strings/rindex.py", line 10, in <module> print(a.rindex("gr", 8, 16)) ValueError: substring not found