python writelines newline
lines = ['line1', 'line2']
with open('filename.txt', 'w') as f:
f.writelines("%s\n" % l for l in lines)
Thankful Teira
lines = ['line1', 'line2']
with open('filename.txt', 'w') as f:
f.writelines("%s\n" % l for l in lines)
fw.write('\n'.join(line_list) + '\n')
#python writelines with \n
with open(f'{dir_path}/data/zlinks.txt', 'w', encoding='utf-8') as f:
f.writelines(f"{l}\n" for l in links)