Collection Methods

collections.deque.index()

Find the first equal value in the optional index interval; return its index relative to the whole deque, or raise ValueError.

Formal Syntax & Structure

python syntaxpython
deque_instance.index(x[, start[, stop]])

Parameters & Attributes

NameTypeDescription
xobjectValue to append, remove, search for or insert.
startint or numberInclusive start index.
stopintExclusive stop index; omit to search to the end.

Return Value

int

The int result described above.

Working Example

Example Snippetpython
import collectionsd=collections.deque([1,2,1])print(d.index(1,1))
Python Reference