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
| Name | Type | Description |
|---|---|---|
| x | object | Value to append, remove, search for or insert. |
| start | int or number | Inclusive start index. |
| stop | int | Exclusive 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))