4

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.)

Adrien
  • 469
  • 3
  • 11

1 Answers1

10

There's find.

Returns the first index of item in a or -1 if not found. This requires appropriate items and == operations to work.

flyx
  • 35,506
  • 7
  • 89
  • 126