Quote:
Originally Posted by BrianK
I'm getting some text fields from a database that have newlines. Is there a simple way to convert the newlines to <br>\n in [mod_]python?
|
I don't know if there is a builtin one, but it is easily made:
Code:
def nl2br(s):
return '<br />\n'.join(s.split('\n'))