1 import queue 2 # q = queue.PriorityQueue() # 带优先级 3 q = queue.LifoQueue() # 后进先出 4 q.put(2) 5 q.put('hello') 6 q.put('asdfasd') 7 print(q.qsize()) # 有几个值 8 print(q.empty()) # 是否为空 9 print(q.full()) # 是否为满 10 while 1: 11 12 data = q.get() 13 print(data)