iratxe iratxe - 1 year ago 54
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']
Recommended from our users: Dynamic Network Monitoring from WhatsUp Gold from IPSwitch. Free Download