a = [0,1,2,3,4,5] for b in a: print \":\"+str(b) a.pop(0)
Thinking that this would work in order going through the entire list and all its items I
If you want to use .pop() in a loop, a common idiom is to use it with while:
.pop()
while
a = [0,1,2,3,4,5] while a: print ":{}".format(a.pop(0))
Or, if you want the printed pattern you have there:
a = [0,1,2,3,4,5] while a: print ":{}\n{}".format(a[0],a.pop(0))
prints
:0 0 :1 1 :2 2 :3 3 :4 4 :5 5