I have a nested list:
encode= [['t','h','i','s'],['i','s'],['a','w','s','o','m','e']]
and I want to convert the nested list above into a string:
"this is awesome"
I have a nested list:
encode= [['t','h','i','s'],['i','s'],['a','w','s','o','m','e']]
and I want to convert the nested list above into a string:
"this is awesome"
the join in the list comprehension joins the letters into words, then the join outside the list joins the words into a sentence
' '.join([''.join(x) for x in encode])
Simply:
words = [''.join(word) for word in encode]
sentence = ' '.join(words)
l =" ".join(["".join(i) for i in encode])