I have a file with the following content.
1
2
3
Now I want to write 4,5 and 6 so that the file content will be like below
1
2
3
4
5
6
Instead of writing 4,5 and 6 by doing file.write("4" + '\n')
, file.write("5" + '\n')
, file.write("6" + '\n')
, how can I write all those last three number with just calling file.write command only once?
Update: I do not know in advance how many number I will be adding to the file. Numbers that will be added are stored in a giant list.