flatten a list of list

Terry terry.yinzhe at gmail.com
Sun Aug 16 11:47:42 CEST 2009


Hi,

Is there a simple way (the pythonic way) to flatten a list of list?
rather than my current solution:

new_list=[]
for l in list_of_list:
    new_list.extend(l)

or,

new_list=reduce(lambda x,y:x.extend(y), list_of_list)

br, Terry



More information about the Python-list mailing list