Converting a list to a string [duplicate]
Solution 1:
Try str.join
:
file2.write(' '.join(buffer))
Documentation says:
Return a string which is the concatenation of the strings in the iterable iterable. The separator between elements is the string providing this method.
Solution 2:
''.join(buffer)