Convert StringIO to string

Jonathan Bowlas me at
Mon Oct 16 15:50:55 CEST 2006

Ok, I think I'm explaining this badly because I've used getvalue() in the
script I originally submitted to the list, see below:


from StringIO import StringIO


def generator_file(rsspath,titleintro,tickeropt): 


      scripter.write('<script type="text/javascript">\n')

      scripter.write('new rss_ticker(%s, %s, %s)\n' % (rsspath, titleintro,


      return scripter.getvalue()



The problem is this script returns the following:


&lt;script type="text/javascript"&gt;

new rss_ticker(, True, True) &lt;/script&gt;


And I want to replace the &lt; and &gt; characters for < or > so it actually
renders correctly in a browser so I'm returned this:


<script type="text/javascript">

new rss_ticker(, True, True) </script>


So what am I doing wrong?




-------------- next part --------------
An HTML attachment was scrubbed...
URL: <>

More information about the Python-list mailing list