Python 如何将项目连接到列表中?

Python 如何将项目连接到列表中?,python,python-3.x,python-2.7,Python,Python 3.x,Python 2.7,你好,我有这个名单: a = [["Hello", "Good Bye"],["Country", "Test"]] 我想把这些子项连在一起,我的意思是我想有这样一个: a = ["Hello Good Bye", "Country Test"] 你能帮我吗 多谢各位 您可以使用,它将函数应用于列表中的所有元素 >>> a = [["Hello", "Good Bye"],["Country", "Test"]] >>> res = list(map("

你好,我有这个名单:

a = [["Hello", "Good Bye"],["Country", "Test"]]
我想把这些子项连在一起,我的意思是我想有这样一个:

a = ["Hello Good Bye", "Country Test"]
你能帮我吗

多谢各位

您可以使用,它将函数应用于列表中的所有元素

>>> a = [["Hello", "Good Bye"],["Country", "Test"]]
>>> res = list(map(" ".join, a))
>>> res
['Hello Good Bye', 'Country Test']

您可以使用列表:

[' '.join(sublist) for sublist in a]