基本概念 与队列不同,栈为LIFO,后进先出。 方法 python中用列表模拟栈 s=[] s.append(1) #入栈 s=[1] s.append(2) #入栈 s=[1,2] item = s.pop() #出栈 s=[1],item=2