I've perused the available threads and nothing worked. Tried this approach with the double-slashes, it didn't work. Also tried the raw-string approach as r\n
and that didn't work either.
I need to replace all newlines (let's start with \n
) to <br/>
. See the following screenshots showing how the result doesn't change from the original string, which is obj.get(key)
:
.replace('\\n', '<br/>')
.replace(r'\n', '<br/>')
')` to replace actual newlines. – ShadowRanger Apr 03 '22 at 16:34
'.join(text.splitlines())`. – ekhumoro Apr 03 '22 at 16:45