Collection Methods

collections.deque.popleft()

Remove and return the leftmost item; raise IndexError when empty.

Formal Syntax & Structure

python syntaxpython
deque_instance.popleft()

Return Value

object

The object result described above.

Working Example

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