import queue q = queue.Queue() for i in range(11,16): q.put(i) q.qsize() while q.qsize() > 0: print(f'Getting {q.get()}, the queue size is {q.qsize()}') lifo = queue.LifoQueue() for i in range(11, 16): lifo.put(i) lifo.qsize() while lifo.qsize() > 0: print(f'Getting {lifo.get()}, the lifo size is {lifo.qsize()}') priority_q = queue.PriorityQueue() priority_q.put((1, 'Task priority 1')) priority_q.put((3, 'Task priority 3')) priority_q.put((2, 'Task priority 2')) priority_q.put((2, 'Task priority 2 - again')) while priority_q.qsize() > 0: print(f' Getting {priority_q.get()}, the priority queue size is {priority_q.qsize()}')
import queue my_path = '/home/boss/data/projects/bakery/prices.csv' q = queue.LifoQueue() for part in my_path.split('/'): q.put(part) while q.qsize()>0: print(q.get())