Python 3: Write newlines to HTML I have upgraded to Python 3 and can’t figure out how to convert backslash escaped newlines to HTML.