Possible Duplicate:
Making a flat list out of list of lists in Python
how can I create form a list e.g [[1,2],[3,4]] or [(1,2),(3,4)]
the list [1,2,3,4]
list comprehension(or map, filter)doesn’t seems to have map object to more than one other object.
like SelectMany in C#’s LINQ
Provided you know that it will be exactly 2 levels deep, you can do
where you iterate with
iover the list, givingisuccessively the values[1,2]and[3,4], and withjover these sub-lists. Thus this expression results to[1, 2, 3, 4].