标签:bsp port get 级别 style first cond lifo color
(1)先进先出
import queue q=queue.Queue() q.put(‘first‘) q.put(‘second‘) q.put(‘third‘) print(q.get()) print(q.get()) print(q.get()) ‘‘‘ first second third
‘‘‘
(2)后进先出
import queue q=queue.LifoQueue() q.put(‘first‘) q.put(‘second‘) q.put(‘third‘) print(q.get()) print(q.get()) print(q.get()) ‘‘‘ third second first ‘‘‘
(3)优先级别:数字越小,优先级别越高
import queue
q=queue.PriorityQueue() q.put((20,"first")) q.put((10,"second")) q.put((30,"third")) print(q.get()) print(q.get()) print(q.get()) ‘‘‘ (10, ‘second‘) (20, ‘first‘) (30, ‘third‘)
标签:bsp port get 级别 style first cond lifo color
原文地址:https://www.cnblogs.com/hapyygril/p/12590873.html