En Mon, 14 Sep 2009 23:33:05 -0300, tec <technic....@gmail.com> escribió:

or use filter
list=filter(lambda x: len(x)>0, list)

For strings, len(x)>0 <=> len(x) <=> x, so the above statement is equivalent to:

list=filter(lambda x: x, list)

which according to the documentation is the same as:

list=filter(None, list)

which is the fastest variant AFAIK.

(Of course, it's even better to use the right split() call so there is no empty strings to filter out in the first place)

--
Gabriel Genellina

--
http://mail.python.org/mailman/listinfo/python-list

Reply via email to