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

Friðrik Már Jónsson fridrik at pyth.net
Wed Jul 8 11:03:56 EDT 2009


ma wrote:
> filter(lambda x: x, your_list)

Good call! Equivalent but more efficient:

  filter(None, your_list)

Regards,
Friðrik Már


More information about the Python-list mailing list