Find a value's index using the index method
suggest changeindex() returns first index of the matching value. Remember that arrays are zero-indexed.
my_array = array('i', [1,2,3,4,5])
print(my_array.index(5))
# 4
my_array = array('i', [1,2,3,3,5])
print(my_array.index(3))
# 2
Note in that second example that only one index was returned, even though the value exists twice in the array.
Found a mistake? Have a question or improvement idea?
Let me know.
Table Of Contents