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
| Name | Type | Description |
|---|---|---|
| a | object | Left operand or target object. |
| b | object | Right operand. |
Return Value
int
The int result described above.
Working Example
Example Snippetpython
import operatorprint(operator.indexOf([4,7,7],7))