堆栈和队列
(1)堆栈,新放进去的先取出
#encoding=utf-8
>>> stack = [3, 4, 5] >>> stack.append(6) >>> stack.append(7) >>> print (stack) [3, 4, 5, 6, 7] >>> print (stack.pop()) 7 >>> print (stack) [3, 4, 5, 6] >>> print (stack.pop()) 6 >>> print (stack.pop()) 5 >>> print (stack) [3, 4] >>>
(2)队列
队列:按顺序取出
(一)简单应用
s = ["a","b","c","d","e"]
s.pop(0)
print(s)