In memory File

Salvatore salvatore at wanadoo.fr
Sat Apr 5 05:17:55 EST 2003


Erik Max Francis wrote:

> Salvatore wrote:
> 
> 
>>I wanted to redirect sys.stdout to StringIO object but il doesn't seem
>>to work
> 
> 
>>>>import StringIO
>>>>import sys
>>>>sys.stdout = StringIO.StringIO()
>>>>print "Told you"
>>>>print >> sys.stderr, sys.stdout.getvalue()
> 
> Told you
> 

I am a poor Python coder ;-)

Thanks Erik






More information about the Python-list mailing list