Writing string to a file on a new line every time

Use “\n”:

file.write("My String\n")

See the Python manual for reference.

Leave a Comment