iterate over list while changing it

Warpcat warpcat at sbcglobal.net
Thu Sep 24 16:55:32 EDT 2009


iterate over a copy of the list:

for i, x in enumerate(a[:]):

Always worked for me ;)



More information about the Python-list mailing list