Collection Methods

collections.deque.append()

Append at the right end, discarding the leftmost item if a bounded deque is full.

Formal Syntax & Structure

python syntaxpython
deque_instance.append(x, /)

Parameters & Attributes

NameTypeDescription
xobjectValue to append, remove, search for or insert.

Return Value

None

No return value; the operation changes the receiver in place.

Working Example

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