标签:get 代码 env lap zhang port dac auth import
先入先出、先入后出;按优先级
#!/usr/bin/env python # Author:Zhangmingda import queue q = queue.Queue() #先入先出 q.put(‘A‘) q.put(‘B‘) q.put(‘C‘) print(q.get()) print(q.get()) print(q.get())
#!/usr/bin/env python # Author:Zhangmingda import queue q = queue.LifoQueue() #先入后出 q.put(‘A‘) q.put(‘B‘) q.put(‘C‘) print(q.get()) print(q.get()) print(q.get())
#!/usr/bin/env python # Author:Zhangmingda import queue q = queue.PriorityQueue() #优先级策略put内容为元组,第一个为优先级代码,必须全部为数字或者字母 q.put((3,‘zhangsan‘)) q.put((5,‘lisi‘)) q.put((1,‘wangwu‘)) print(q.get()) print(q.get()) print(q.get())
标签:get 代码 env lap zhang port dac auth import
原文地址:https://www.cnblogs.com/zhangmingda/p/9251615.html