examples/strings/rindex.py
from __future__ import print_function

a = "The black cat climbed the green tree."
print(a.rindex("c"))         # 14
print(a.rindex("c", 8))      # 14
print(a.rindex("c", 8, 13))  # 10

print(a.rindex("gr", 8))     # 26
print(a.rindex("gr", 8, 16))


examples/strings/rindex.py.out
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