I am writing strings to a text document using python 2.7
I am not adding then "\n" newline character until the very end of each line, yet when I open up the text document, newlines are being created on their own.
What am I doing wrong?
My code looks like this:
w.write(ID + " " + Name + " " + x + " " + y + " " + "\n")
w.write(ID2 + " " + Name2 + " " + x2 + " " + y2 + " " + "\n")
My text document looks like this:
1—-Polyline1—-0.567
—-0.837
2—-Polyline2—-0.928
—-0.253
^^^Those are spaces, not dashes
Because you forgot to strip the newlines from
xandx2after reading them.Also, ␣ and ␢.