Reputation: 489
Is there a builtin method to find the index of an item in an array or sequence, equivalent to Python index ? (It may return the index of the first occurrence, or all the indices.)
index
Upvotes: 5
Views: 4352
Reputation: 39768
There's find.
Returns the first index of item in a or -1 if not found. This requires appropriate items and == operations to work.
Upvotes: 12