Append an object to a append in Python

You can append an object to a deque by the append() like list.

from collections import deque

d = deque([1, 2, 3])
d.append(4)

print(d)  # deque([1, 2, 3, 4])

for i in d:
    print(i)

# 1
# 2
# 3
# 4

Python Deque

Python Tutorial