I’m parsing text from a file with Python. I have to replace all newlines with <br />. I tried this code:
thatLine.replace('\n', '<br />')
print thatLine
But I still see the text with newline after it. Why?
Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.
Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.
Lost your password? Please enter your email address. You will receive a link and will create a new password via email.
Please briefly explain why you feel this question should be reported.
Please briefly explain why you feel this answer should be reported.
Please briefly explain why you feel this user should be reported.
Just for kicks, you could also do
to replace all newlines in a string with
<br />.