Answers for "python writelines newline"

3

python writelines newline

lines = ['line1', 'line2']
with open('filename.txt', 'w') as f:
    f.writelines("%s\n" % l for l in lines)
Posted by: Guest on October-19-2020
0

write lines python with line breaks

fw.write('\n'.join(line_list) + '\n')
Posted by: Guest on July-31-2020

Python Answers by Framework

Browse Popular Code Answers by Language