#堆栈的实现
list=["apple","banana","grape"]
list.append("orange")
print list
print"弹出的元素:",list.pop()#默认弹出末位
print list
#队列的实现
list=["apple","banana","grape"]
list.append("orange")
print list
print "弹出的元素:",list.pop(0)#弹出第一位
list=["apple","banana","grape"]
list.append("orange")
print list
print"弹出的元素:",list.pop()#默认弹出末位
print list
#队列的实现
list=["apple","banana","grape"]
list.append("orange")
print list
print "弹出的元素:",list.pop(0)#弹出第一位
print list
======================= RESTART: C:/Python27/list4.py =======================
['apple', 'banana', 'grape', 'orange']
弹出的元素: orange
['apple', 'banana', 'grape']
['apple', 'banana', 'grape', 'orange']
弹出的元素: apple
['banana', 'grape', 'orange']