队列与堆栈案例 队列:先进先出FIFO q = [] # 入队 q.append('first') q.append('second') q.append('third') # 出队 print(q.pop(0)) print(q.pop(0)) print(q.pop(0)) 堆栈:后进后出LIFO t = [] # 入栈 t.append('first') t.append('second') t.append('third') # 出栈(不加就是-1) print(t.pop(-1)) print(t.pop(-1)) print(t.pop(-1))