[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
- 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 ]
ma wrote:
> filter(lambda x: x, your_list)
Good call! Equivalent but more efficient:
filter(None, your_list)
Regards,
Friðrik Már
- 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