kaushik kaushik - 1 year ago 83
Python Question

writing string to a file on a new line everytime?

I want to append a newline to my string every time I call

file.write()
. What's the easiest way to do this in Python?

Answer Source

Use "\n":

file.write("My String\n");

See the Python manual for reference.

Recommended from our users: Dynamic Network Monitoring from WhatsUp Gold from IPSwitch. Free Download