Try str.join:
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.
1.4m articles
1.4m replys
5 comments
56.9k users