Create a queue
Import Queueq = queue. Queue ()
Empty (returns True if the queue is empty)
Import Queueq = queue. Queue () print (Q.empty ()) #输出: True
Full (returns True if the queue is filled)
Import Queueq = queue. Queue (1) #指定队列大小q. Put (' a ') print (Q.full ()) #输出: True
Put (put an element into the queue) get (take an element out of a queue) FIFO principle
Import Queueq = queue. Queue () q.put (' A ') q.put (' B ') print (Q.get ()) #输出: A
Get_nowait (immediately remove an element without waiting)
#占位
Put_nowait (immediately put an element, do not wait)
#占位
Join (blocks the calling thread until all tasks in the queue are processed)
#占位
Qsize (returns the number of elements in the queue)
Import Queueq = queue. Queue () q.put (' A ') q.put (' B ') print (Q.qsize ()) #输出: 2
Task_done (after completing a task, send a signal to the queue that the task has completed)
#占位