Jan-31-2018, 01:08 AM
Calling write 6 times
A good solution has been posted bye @micseydel.
Working code both do the same:
![Doh Doh](https://python-forum.io/images/smilies/eusa_doh.gif)
A good solution has been posted bye @micseydel.
Working code both do the same:
lst = ['line 1', 'line 2', 'line 3'] # Yes with open('out_1.txt', 'w') as f_out: f_out.write('\n'.join(lst)) # No with open('out_2.txt', 'w') as target: target.write(lst[0]);target.write("\n");target.write(lst[1]);target.write("\n");target.write(lst[2]);target.write("\n")