栈的特点:先进后出
class Stack: def __init__(self): self.data = [] def push(self, val): self.data.append(val) def pop(self): ret = self.data.pop() return ret s = Stack() s.push('love') s.push('python') print(s.pop()) # python