how to flatten one level of list of lists?

John Rickard jrr at 0.0.0.10
Wed May 30 09:03:46 EDT 2001


George Young <gry at ll.mit.edu> wrote:
: I have a list like:
:   l = [[2], [3], [5], [11]]
: and I want to get:
:   ll = [2, 3, 5, 11]

Short but silly solution:

  ll = map(max,l)

-- 
John Rickard   <John.Rickard at virata.com>



More information about the Python-list mailing list