replacing characters within a string
clp at rebertia.com
Sun Nov 9 06:39:50 CET 2008
On Sat, Nov 8, 2008 at 9:16 PM, John Smith <swader at gmail.com> wrote:
> I coded a python script that lets me parse a csv file into html code with a
> certain format, but I would like to replace every "<" and ">" character that
> appears within each column entry of the csv file (they are parsed as
> strings) with the html equivalents of "<" and ">".
You want the cgi.escape() function -
Follow the path of the Iguana...
> example csv file row:
> "FIXED","All","Enable <audio> entry"
> and I want to replace <audio> with <audio> before I do a
> "<p>This is a " + str(array) + " bug that applies to " + str(array) +
> " platforms and has the description: " + str(array) + ".</p>"
> to get the following html code:
> <p>This is a FIXED bug that applies to All platforms and has the
> description: Enable <audio> entry.</p>
> (sometimes < appears twice or thrice and sometimes only > appears so they
> are not necessarily appearing together, e.g. -> instead of <something>)
> How should I go about doing it?
More information about the Python-list