[Tutor] buffering print statement

Barnaby Scott barnabydscott at yahoo.com
Thu Dec 18 09:00:11 EST 2003


Is there a simple way of redirecting the output of
'print' statements in a script, until such time as I
actually want them sent to stdout, and they can all be
sent at once?

I guess I could create a file-like object and then use
'print >>' to it, but this is not what I am after
ideally.

Equally I know I could assign sys.stdout to my
'buffer', but I don't know how to reverse the process
and get at the output when I want it! 

As you can tell from my ramblings, I'm none too
advanced, and would be grateful for a steer!

__________________________________
Do you Yahoo!?
New Yahoo! Photos - easier uploading and sharing.
http://photos.yahoo.com/



More information about the Tutor mailing list