Working with the deque Class : deque « Collections « Python Tutorial






from collections import deque
dq = deque()
for e in dq :
    print e


dq1 = deque(['a','b','c'])
for e in dq1 :
   print e

dq2 = deque({1:"a", 2:"b", 3:"c"})
for e in dq2 :
   print e

dq3 = deque(dq1)
for e in dq3 :
    print e








9.1.deque
9.1.1.Double-ended queues, or deques, can be useful when you need to remove elements in the order
9.1.2.Working with the deque Class