do you master list comprehensions?

Diez B. Roggisch deetsNOSPAM at web.de
Mon Dec 13 16:20:12 EST 2004


>>> data = [['foo','bar','baz'],['my','your'],['holy','grail']]
>>> [e for l in data for e in l]
['foo', 'bar', 'baz', 'my', 'your', 'holy', 'grail']
-- 
Regards,

Diez B. Roggisch



More information about the Python-list mailing list