Queue.qsize()
Queue.qsize() is a Python method in the Queue Module category. Returns the approximate size of the queue. The syntax is Queue.qsize(). Returns: Integer size. A typical example: if q.qsize() < 100: q.put(more_data). A close sibling is queue.Queue(), which creates a FIFO (First-In-First-Out) thread-safe queue. A close sibling is queue.LifoQueue(), which creates a LIFO (Last-In-First-Out) thread-safe queue (stack). A close sibling is queue.PriorityQueue(), which creates a thread-safe priority queue (lowest value is retrieved first). A close sibling is Queue.put(), which puts an item into the queue. Blocks if full until space is available. More about this category: Thread-safe queues — Queue, LifoQueue, PriorityQueue, SimpleQueue. Related Queue Module entries: queue.Queue(), queue.LifoQueue(), queue.PriorityQueue(), Queue.put(), Queue.get(), Queue.task_done(). This page is part of the free Python Reference documentation covering 978+ functions, methods, and modules with examples and parameter details. You can try Queue.qsize() immediately in the Python playground, look up unfamiliar terms in the glossary, or return to the Python Reference homepage.