The Problem is When you denote '\n'
in the replace()
call , '\n'
is treated as a String length=4
made out of ' \ n '
To get rid of this, use ascii notation. http://www.asciitable.com/
example:
newLine = chr(10)
thatLine=thatLine.replace(newLine , '<br />')
print(thatLine) #python3
print thatLine #python2
.