from multiprocessing import Queue
q = Queue(3)
q.put('aaa')
q.put('bbb')
q.put('ccc')
print(q.full()) #判断当前队列是否已满
print(q.empty()) #判断队列是否为空
a = q.get()
b = q.get()
c = q.get()
#d = q.get() #没数据时一直等待
d = q.get_nowait() #没数据时不等待,直接报错
# d = q.get(timeout=2) #没数据时,等2秒超时再报错
print(a, b, c, d,)
===========================================================================================
import queue
q=queue.Queue(3)
q.put('aaa')
q.get()
q.get_nowait()
q.get(timeout=2)
q.full()
q.empty()
q_l=queue.LifoQueue(2) #last in fist out
q_p=queue.PriorityQueue(3)
q_p.put((100, 'aaa'))
q_p.put((20,'bbb'))
print(q_p.get()) #优先级小的先出