# stack.py stack = [] while 1: x = raw_input('push data or [ret] to pop: ') if x == '': print stack.pop() else: stack.append(x)