I am trying to convert a list of list into a single string using python and I don't want to use any loops I want to do it using lambda in Python but not getting the desired result. here is my code:
#!/usr/bin/python
import sys
import math
from functools import reduce
def collapse(L):
list = lambda L: [item for sublist in L for item in sublist]
#sum(L, [])
#print('"',*list,sep=' ')
#whole_string = ''.join(list).replace(' ')
l=[ ["I","am"], ["trying", "to", "convert"], ["listoflist", "intoastring."]]
collapse(l)
print(*l,sep='')
I want an output like this "I am trying to convert listoflist intoastring."