What is the most efficient way to do this?

Tim Legant tim-dated-1013892102.1a1a7a at catseye.net
Fri Feb 8 21:41:40 CET 2002


"MDK" <mdk at mdk.com> writes:

> What is the most efficient way to remove empty items from this list?
> 
> ['', '1', '2', '3', '', '456', '789', 'wow']

>>> lst = ['', '1', '2', '3', '', '456', '789', 'wow']
>>> filter(None, lst)
['1', '2', '3', '456', '789', 'wow']


Tim




More information about the Python-list mailing list