Queue is usually used for data exchange between threads in Python. The
provides manipulations of Queues.
Create a Queue object:
>>> import queue >>> q = queue.Queue(maxsize=5) >>> q
(queue.Queue object at 0x024D65B0)Put item into the queue:
Remove an item from the queue:
queuemodule manipulates 3 types of queue:
queue.Queue(maxsize=0): FIFO queue, first in first out, the first tasks added are the first retrieved.
queue.LifoQueue(maxsize=0): last in first out.
queue.PriorityQueue(maxsize=0): the lowest valued entries are retrieved first.
queuemodule methods list: