Better solution

Bo M. Maryniuck b.maryniuk at forbis.lt
Tue Aug 20 16:51:18 CEST 2002


Well, I want to throw away a _same_ garbage from a list with less of coding.
This is current code, sure not the best ;-) Is any better solutions?

--------------8<------------------------
lst = ['', 'a', '', 'b', 'c', '', 'd']
map(lambda z:lst.pop(lst.index('')), range(0, lst.count('')))
--------------8<------------------------

Now lst equals to ['a', 'b', 'c', 'd'].

-- 
Regards, Bogdan

If you are good, you will be assigned all the work.  If you are real
good, you will get out of it.





More information about the Python-list mailing list