Simple newbie question
Angelo Secchi
secchi at sssup.it
Thu Dec 4 09:36:11 EST 2003
Hi,
I'm trying to remove lines with zeros from a list "lista".
The code i'm using is the following:
for line in lista:
if sum(line == 0) > 0:
lista.remove(line)
The problem is that the loop stops at the first line with zeros and it
doesn't remove the other lines with zeros (at least if I do not re-run
the loop). Probably I do not understand how the loop works.
Any help ?
Thanks,
Angelo
More information about the Python-list
mailing list