Re: Convert StringIO to string

2006-10-16 Thread Fredrik Lundh
Jonathan Bowlas wrote: > 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=StringIO() > > scripter.w

RE: Convert StringIO to string

2006-10-16 Thread Jonathan Bowlas
Of Rob Williscroft Sent: 16 October 2006 14:37 To: python-list@python.org Subject: Re: Convert StringIO to string Jonathan Bowlas wrote in news:[EMAIL PROTECTED] in comp.lang.python: > Hi listers, > > I've written this little script to generate some html but I cannot get > it to co

RE: Convert StringIO to string

2006-10-16 Thread Jonathan Bowlas
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=StringIO()   scripter.write('\n')

Re: Convert StringIO to string

2006-10-16 Thread Rob Williscroft
Jonathan Bowlas wrote in news:[EMAIL PROTECTED] in comp.lang.python: > 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 >

Re: Convert StringIO to string

2006-10-16 Thread Brian Quinlan
Jonathan Bowlas wrote: > Ahh thanks, I'll give that a try. > > -Original Message- > From: [EMAIL PROTECTED] > [mailto:[EMAIL PROTECTED] On Behalf Of > [EMAIL PROTECTED] > Sent: 16 October 2006 14:00 > To: python-list@python.org > Subject: Re: Convert

Re: Convert StringIO to string

2006-10-16 Thread paul
Jonathan Bowlas schrieb: > 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,ticke

RE: Convert StringIO to string

2006-10-16 Thread Jonathan Bowlas
Ahh thanks, I'll give that a try. -Original Message- From: [EMAIL PROTECTED] [mailto:[EMAIL PROTECTED] On Behalf Of [EMAIL PROTECTED] Sent: 16 October 2006 14:00 To: python-list@python.org Subject: Re: Convert StringIO to string Jonathan Bowlas wrote: > But obviously replace()

Re: Convert StringIO to string

2006-10-16 Thread skryskalla
Jonathan Bowlas wrote: > 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? StringIO objects are file-like objects, so you need to use read or readlines to get the string data out of it (just like