Open this example in the interactive library
Source code
from collections import deque
queue = deque(['first', 'second'])
print(queue.popleft(), list(queue))Sample output
first ['second']

Process a FIFO queue. A self-contained example using the Python standard library.
Open this example in the interactive library
from collections import deque
queue = deque(['first', 'second'])
print(queue.popleft(), list(queue))first ['second']