String Replacement

Fazer faizan at jaredweb.com
Fri Aug 1 18:00:47 EDT 2003


Hello,

As some of you might know, I am new to Python.  I was finally
successful in using MySQLdb for Python to query the datbase and get a
few results from the query.

The results will be displayed as HTML and I am sort of confuse din
using the string modules and its functions/modules to replace the \n
with <br>.  I import the string module and I am not soo sure on how to
do the replacing.

Here's how my code sort of likes:

import string
string.replace(DataFromDatabase, "\n", "<br>")

Unfortunately, it doesn't work.  

Thanks in advance,

Fazer




More information about the Python-list mailing list