队列
from queue import Queue
# 队列 --- 先进先出
q = Queue()
for i in range(5):
q.put(i)
while not q.empty():
print(q.get())
0
1
2
3
4
from queue import LifoQueue
# 队列 --- 先进后出 类似于栈
q = LifoQueue()
for i in range(10, 15):
q.put(i)
while not q.empty():
print(q.get())
14
13
12
11
10