examples/strings/index.py
from __future__ import print_function

a = "The black cat climbed the green tree."
print(a.index("bl"))     # 4
print(a.index("The"))    # 0
print(a.index("dog"))
examples/strings/index.py.out
4
0
Traceback (most recent call last):
  File "examples/strings/index.py", line 6, in <module>
    print a.index("dog")    # -1
ValueError: substring not found