If you run
tmpl = "This is the first line\n And this is the second line" print("tmpl)
you get
This is the first line And this is the second line
So you get a new line expanded.
But if you write in a file, you will not get that:
Put in
test.tmpl
:This is the first line\n And this is the second line
and run
with open("test.tmpl") as f: contents = f.read() print(contents)
you get
This is the first line\n And this is the second line
Why this behaviour? How can you get the the contents
displays the same than tmpl
?