On this page
operator.indexOf
Prev: operator.index | Up: operator | Next: operator.inv
Rel: operator.abs, operator.add, operator.and_, operator.attrgetter
Ref: docs.python.org — operator.indexOf
Tags: #public #python3 #stdlib #operator
Import
import operator
from operator import indexOf
Signature & Overview
operator.indexOf(a, b, /)
Return the first index of b in a.
Usage
import operator
assert operator.indexOf(["a", "b", "c"], "b") == 1
Gotchas
- Raises
ValueErrorif not found: Works on any iterable, not justlist/tuple.
REPL Inspect
from operator import indexOf
help(indexOf)
Linked from
Related notes
- tuts/python3/stdlib_module/operator/index Linked here; links to this page; shared tags: #operator, #stdlib
- tuts/python3/stdlib_module/operator/inv Linked here; links to this page; shared tags: #operator, #stdlib
- tuts/python3/stdlib_module/operator Linked here; links to this page; shared tags: #stdlib
- tuts/python3/stdlib_module/operator/abs Linked here; shared tags: #operator, #stdlib
- tuts/python3/stdlib_module/operator/add Linked here; shared tags: #operator, #stdlib
- tuts/python3/stdlib_module/operator/and_ Linked here; shared tags: #operator, #stdlib
- tuts/python3/stdlib_module/operator/attrgetter Linked here; shared tags: #operator, #stdlib
- tuts/python3/stdlib_module/operator/call shared tags: #operator, #stdlib
- tuts/python3/stdlib_module/operator/concat shared tags: #operator, #stdlib
- tuts/python3/stdlib_module/operator/contains shared tags: #operator, #stdlib