Operator Functions

operator.indexOf()

Return the zero-based position of the first matching value in iterable a; raise ValueError if absent. May consume an iterator up to the match.

Formal Syntax & Structure

python syntaxpython
operator.indexOf(a, b, /)

Parameters & Attributes

NameTypeDescription
aobjectLeft operand or target object.
bobjectRight operand.

Return Value

int

The int result described above.

Working Example

Example Snippetpython
import operatorprint(operator.indexOf([4,7,7],7))
Python Reference