Hi listers,

I've written this little script to generate some html but I cannot get it to
convert to a string so I can perform a replace() on the >, <
characters that get returned.

from StringIO import StringIO

def generator_file(rsspath,titleintro,tickeropt): 
        scripter=StringIO()
        scripter.write('<script type="text/javascript">\n')
        scripter.write('new rss_ticker(%s, %s, %s)\n' % (rsspath,
titleintro, tickeropt))
        scripter.write('</script>\n')
        return scripter.getvalue()

I tried adding this:

scripter = scripter.replace("&lt;", "<")
scripter = scripter.replace("&gt;", ">")

But obviously replace() isn't an attribute of StringIO so I guess I need to
convert it to a string first, can someone please advise how I can do this?

Cheers

Jon


-- 
http://mail.python.org/mailman/listinfo/python-list

Reply via email to