[0, 0, 0, 1, 1, 1, 0] ... remove all 0 values

J Kenneth King james at agentultra.com
Wed Jul 8 12:31:40 EDT 2009


Friðrik Már Jónsson <fridrik at pyth.net> writes:

> ma wrote:
>> filter(lambda x: x, your_list)
>
> Good call! Equivalent but more efficient:
>
>  filter(None, your_list)
>
> Regards,
> Friðrik Már

I was wondering when someone would mention filter()



More information about the Python-list mailing list