[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
- Previous message (by thread): [0, 0, 0, 1, 1, 1, 0] ... remove all 0 values
- Next message (by thread): [0, 0, 0, 1, 1, 1, 0] ... remove all 0 values
- Messages sorted by:
[ date ]
[ thread ]
[ subject ]
[ author ]
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()
- Previous message (by thread): [0, 0, 0, 1, 1, 1, 0] ... remove all 0 values
- Next message (by thread): [0, 0, 0, 1, 1, 1, 0] ... remove all 0 values
- Messages sorted by:
[ date ]
[ thread ]
[ subject ]
[ author ]
More information about the Python-list
mailing list