how to break a for loop?

Gregory Petrosyan gregory.petrosyan at gmail.com
Mon Feb 20 18:00:51 EST 2006


Hello!
It's 1:56 o'clock in St.-Petersburg now, and I am still coding... maybe
that's why I encountered stupid problem: I need to remove zeros from
the begining of list, but I can't :-(. I use

        for i,coef in enumerate(coefs):
            if coef == 0:
                del coefs[i]
            else:
                break

but it removes ALL zeros from list. What's up?


P.S. I feel SO stupid asking this quastion... ;-)




More information about the Python-list mailing list