连接列表Python3中的列表列表

连接列表Python3中的列表列表,python,list,python-3.x,Python,List,Python 3.x,我试过itertools,map(),但我不知道怎么了。我有: [['>Fungi|A0A017STG4.1/69-603 UP-domain-containing protein {ECO:0000313|EMBL:EYE99555.1}', ['-', '-', '-', ... , '-', '-', '-', '-']],['>Fungi|A0A017STG4.1/69-603 UP1-domain-containing protein {ECO:0000313|EMBL:E

我试过itertools,map(),但我不知道怎么了。我有:

[['>Fungi|A0A017STG4.1/69-603 UP-domain-containing protein {ECO:0000313|EMBL:EYE99555.1}', ['-', '-', '-', ... , '-', '-', '-', '-']],['>Fungi|A0A017STG4.1/69-603 UP1-domain-containing protein {ECO:0000313|EMBL:EYE99555.1}', ['-', '-', '-', ... , '-', '-', '-', '-']],['>Fungi|A0A017STG4.1/69-603 UP12-domain-containing protein {ECO:0000313|EMBL:EYE99555.1}', ['-', '-', '-', ... , '-', '-', '-', '-']]]
我想要这个:

[['>Fungi|A0A017STG4.1/69-603 UP-domain-containing protein {ECO:0000313|EMBL:EYE99555.1}','-', '-', '-', ... , '-', '-', '-', '-'],['>Fungi|A0A017STG4.1/69-603 UP1-domain-containing protein {ECO:0000313|EMBL:EYE99555.1}','-', '-', '-', ... , '-', '-', '-', '-'],['>Fungi|A0A017STG4.1/69-603 UP10-domain-containing protein {ECO:0000313|EMBL:EYE99555.1}','-', '-', '-', ... , '-', '-', '-', '-']]
我试过了

for i in x:
    map(i,[])
还有这个

import itertools
a = [["a","b"], ["c"]]
print list(itertools.chain.from_iterable(a))
请启发我

必须有更好的Pythonic解决方案,但您可以使用:

n = []
for x in your_list:
    temp_list = [x[0]]
    [temp_list.append(y) for y in x[1]]
    n.append(temp_list)

print(n)

产出:

[['>Fungi|A0A017STG4.1/69-603 UP-domain-containing protein {ECO:0000313|EMBL:EYE99555.1}', '-', '-', '-', Ellipsis, '-', '-', '-', '-'], ['>Fungi|A0A017STG4.1/69-603 UP1-domain-containing protein {ECO:0000313|EMBL:EYE99555.1}', '-', '-', '-', Ellipsis, '-', '-', '-', '-'], ['>Fungi|A0A017STG4.1/69-603 UP12-domain-containing protein {ECO:0000313|EMBL:EYE99555.1}', '-', '-', '-', Ellipsis, '-', '-', '-', '-']]

简单的oneliner可以做到:

[sum(x, []) for x in yourlist]
注意sum(x,[])相当慢,因此对于严肃的列表合并,请使用更有趣、更快速的列表合并技术,这些技术将在

例如,简单的两行程序要快得多

import itertools
map(list, (map(itertools.chain.from_iterable, yourlist)))
可能重复的