标签:style bsp init python pre class nbsp print span
栈的特点:先进后出
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
标签:style bsp init python pre class nbsp print span
原文地址:https://www.cnblogs.com/wt7018/p/11605266.html