标签:优先级 int queue get span code hello priority fifo
先进先出
import queue q =queue.Queue() #FIFO q.put(12) q.put(‘hello‘) q.put({"name":"yuan"}) print(q.qsize()) print(q.full()) print(q.empty()) while True: data = q.get() print(data) print(‘---‘)
先进后出
import queue q =queue.LifoQueue() q.put(12) q.put(‘hello‘) q.put({"name":"yuan"}) while True: data = q.get() print(data) print(‘---‘)
优先级
import queue q =queue.PriorityQueue() q.put([2,12]) q.put([1,‘hello‘]) q.put([3,{"name":"yuan"}]) while True: data = q.get() print(data[1]) print(‘---‘)
标签:优先级 int queue get span code hello priority fifo
原文地址:https://www.cnblogs.com/hb15988111121/p/12376668.html