Pastetool - list_filtering

URL: , Paste another

List Filtering
>>> li = ["a", "mpilgrim", "foo", "b", "c", "b", "d", "d"]
>>> [elem for elem in li if len(elem) > 1]
['mpilgrim', 'foo']
>>> [elem for elem in li if elem != "b"]

Download code

This python code was pasted on September 25, 2009




Protected with advance Anti-SPAM techniques :)
Coded and designed by Fedmich
Follow us on Twitter