How to write a list to a file with newlines in Python3,myfile.write('\n'.join(lines))