In memory File

Erik Max Francis max at alcyone.com
Sat Apr 5 05:11:39 EST 2003


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

-- 
 Erik Max Francis / max at alcyone.com / http://www.alcyone.com/max/
 __ San Jose, CA, USA / 37 20 N 121 53 W / &tSftDotIotE
/  \ Did you ever love somebody / Did you ever really care
\__/ Cassandra Wilson
    Alcyone Systems / http://www.alcyone.com/
 Alcyone Systems, San Jose, California.




More information about the Python-list mailing list