iratxe iratxe - 1 year ago 34
Python Question

Convert a list of characters in a single List , using a List comprehension

I have this list :

listOfWords = ["this","is","a","list","of","words"]

and I need to have
[this is a list of words]
, with a List comprehension.

Answer Source

You mean a list with a single string item?

>>> [' '.join(["this","is","a","list","of","words"])]
['this is a list of words']