user6842389 user6842389 - 7 months ago 30
Python Question

How do I make text go on to the next line (enter/return effect)? Python

I have numerous strings which I am writing into a notepad txt.file via python using

x = open("File", "w")

However i want the strings to be written in the text file in the format:


Instead of this:


I'm missing specific code to achieve the 'keyboard enter/return' affect, so if anyone knows please drop me an answer. Also, I don't want to manually press enter in the actual text file, I want to do it via python. Thanks!


I thought I'd put my comment as an answer.

Here is a related question:

Essentially you should use a new line character which is \n. "\" is an escape character.