examples/strings/index2.py
from __future__ import print_function

a = "The black cat climbed the green tree."
print(a.index("c"))      # 7
print(a.index("c", 8))   # 10

print(a.index("gr", 8))      # 26
print(a.index("gr", 8, 16))
examples/strings/index2.py.out
7
10
26
Traceback (most recent call last):
  File "examples/strings/index2.py", line 8, in <module>
    print a.index("gr", 8, 16) 
ValueError: substring not found