如何删除低优先级任务python队列

时间:2014-12-03 21:39:40

标签: python queue

import Queue as queue

prio_queue = queue.PriorityQueue()
prio_queue.put((1, "Hello Brother"))
prio_queue.put((3, 'Nothing at all'))
prio_queue.put((2, 'Hello Teacher'))

while not prio_queue.empty():
    item = prio_queue.get()
    print ('%s %s' % item)

我有这三个任务并使用python队列库运行它们,只是为了删除最低优先级的任务,即3

0 个答案:

没有答案