myapp breaks a line ('\n') in a file generated, that works locally, but not in pythonanywhere


My app do a break line after writing some words, that works Ok locally, have uploaded that to pythonanywhere and the lines are not being broken.

Following code details:

outfile.write('test line - have tested already with that sintaxe' + "\n")
outfile.write(' ')
outfile.write('this line should be written in the next line\n')
outfile.write('however the lines are not being broken when running in pythonanywhere\n')

The result of this code locally is a file that is downloaded with broken and empty lines after these phrases, have just verified my pythonanywhere folder where the new file is created and that does have the break lines, but when that is downloaded, the file does not have these break lines.

You're probably viewing the file as HTML (I assume that's what you mean by "when it's downloaded"). When you're viewing HTML, all white space is compressed into single spaces.

Thank you Glenn, have opened the file using another text editor than notepad and you are right. Thank you !