本文整理汇总了Python中stack.Stack.show方法的典型用法代码示例。如果您正苦于以下问题:Python Stack.show方法的具体用法?Python Stack.show怎么用?Python Stack.show使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类stack.Stack
的用法示例。
在下文中一共展示了Stack.show方法的2个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Python代码示例。
示例1: move
# 需要导入模块: from stack import Stack [as 别名]
# 或者: from stack.Stack import show [as 别名]
# move data from temp to stack
def move(stack, temp):
if temp.empty():
return;
else:
holder = temp.pop();
move(stack, temp);
stack.push(holder);
if __name__ == "__main__":
print "= test stack operations =";
stack = Stack();
stack.push(1);
stack.push(2);
stack.push(3);
stack.show();
print "==============";
print "pop", stack.pop();
stack.show();
print "==============";
print "peek:", stack.peek();
print "==============";
while not stack.empty():
print "pop", stack.pop();
stack.show();
print "===== done ======";
print "====== start sorting ========";
for i in range(1, 10):
stack.push( randint(1,9) );
stack.show();
示例2: Stack
# 需要导入模块: from stack import Stack [as 别名]
# 或者: from stack.Stack import show [as 别名]
from stack import Stack
s = Stack()
print s.size()
s.push('dalla')
s.show()
print s.size()
print s.isEmpty()