I have a web.py app that takes input from a textarea and inputs it to a database. I can get the information from the database and post it to the page but the NEWLINES are g
Two main ways to do this. The easiest one is to wrap the output in which will format it as entered.
Or, you can replace newlies with (and not with ) as the characters represent a line break and not a paragraph.
For the second option, this is one approach:
>>> s
'hello\nthere\r\nthis\n\ris a test'
>>> r = '
'
>>> s.replace('\r\n',r).replace('\n\r',r).replace('\r',r).replace('\n',r)
'hello
there
this
is a test'
>>>
Or the third option - which is to use one of the many text entry libraries/formats and render the content through them (as mentioned by others - like markdown).
However, that would be overkill if all you want to do is a simple replace.