Returns the index of the first occurrence of a substring (raises ValueError if not found).
Syntax
list.index(item, start?, end?)Example
Enter values below to update the example in real time.
print→index→ValueError→text = "Hello World"
print(text.index("World")) # 6
# text.index("Python") # ValueError