可能重复:
Making a flat list out of list of lists in Python
Join a list of lists together into one list in Python
我有很多看起来像
的列表['it']
['was']
['annoying']
我希望上面看起来像
['it', 'was', 'annoying']
我如何实现这一目标?
答案 0 :(得分:131)
答案 1 :(得分:109)
import itertools
ab = itertools.chain(['it'], ['was'], ['annoying'])
list(ab)
只是另一种方法......
答案 2 :(得分:41)
a = ['it']
b = ['was']
c = ['annoying']
a.extend(b)
a.extend(c)
# a now equals ['it', 'was', 'annoying']