screen off?
Adam Hupp
hupp at upl.cs.wisc.edu
Mon Nov 25 05:34:54 EST 2002
On Fri, 22 Nov 2002 21:49:06 +0000, Lance wrote:
> Hi All,
>
> Some of my programs generate considerable screen output. I would like to
> turn off the screen output to save time while developing. Is there a way to
> do this, and turn it back on again?
You can do this by assigning a new file-like object to sys.stdout, i.e.
sys.stdout = open("/dev/null", "w")
Or even better something of your own design that filters calls to write().
The original stdout is stored in sys.__stdout__ (didn't this used to be
_stdout?) if you would like to restore it.
-Adam
More information about the Python-list
mailing list