Mega Code Archive

 
Categories / Python Tutorial / List
 

The pop method removes an element (by default the last one) from the list and returns it

x = [1, 2, 3] x.pop() print x x.pop(0) print x