class Stack(object):
def __init__(self):
self.con = []
# 入栈
def push(self, i):
self.con.append(i)
# 出栈
def pop(self):
self.con.pop()
s = Stack()
s.push(1)
s.push(2)
s.push(3)
s.push(4)
s.pop()
s.pop()
s.pop()
print(s.con)
Python中的栈, 一般用列表实现
猜你喜欢
转载自blog.csdn.net/qq_44291044/article/details/104632841
今日推荐
周排行