index in string with range
- index
text = "The black cat climbed the green tree."
print(text.index("c")) # 7
print(text.index("c", 8)) # 10
print(text.index("gr", 8)) # 26
print(text.index("gr", 8, 16))
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