I have a lists of lists of strings which I would like to convert to a list of strings adding a space between each list item. eg.
original_list = [['the', 'cat', 'in', 'the', 'hat'], ['fat', 'cat', 'sat', 'on', 'the', 'mat']]
desired_output = ['the cat in the hat', 'fat cat sat on the mat']
I understand that I can do it using this:
desired_output
for each in original_list:
desired_output.append(' '.join(each))
but as I am working with large amounts of data am ideally looking for a more efficient way to do this.
' '.join(each)instead of''.join(each)in your code