【发布时间】:2012-12-26 01:33:14
【问题描述】:
可能重复:
Flattening a shallow list in Python
Making a flat list out of list of lists in Python
Merge two lists in python?
快速简单的问题:
如何合并。
[['a','b','c'],['d','e','f']]
到这里:
['a','b','c','d','e','f']
【问题讨论】:
-
from functools import reduce a = [['a','b','c'],['d','e','f']] reduce(lambda x, y: x+y, a)
-
import itertools original_list = [[2,4,3],[1,5,6], [9], [7,9,0]] new_merged_list = list(itertools.chain(* original_list))
标签: python