Mega Code Archive

 
Categories / Python / Data Structure
 

Use list as a stack

L = [] L.append(1)                    # push onto stack L.append(2) print L L.pop()                        # pop off stack print L