search

search

> Functions

Searches for the element element in the array array, starting from position start.

Parameters
Return
Python

In Python, a.index(value) raises a ValueError when the value is missing, instead of returning -1 like search in LeekScript. Check first — a.index(v) if v in a else -1 — or catch the exception. The second argument is the starting index, as in LeekScript. On a string, s.find(sub) does return -1 when the substring is missing; it is s.index(sub) that raises.