Python index list method - find the location of object or value in the list
Example:
list = [1, "apple", 2, "banana"]
print(list.index(2))
print(list.index("banana", 1))
Output:
2
3
The list
index() method can take a maximum of three arguments:
- element - the element to be searched
- start (optional) - start searching from this index
- end (optional) - search the element up to this index