screen off?

Florian flobauer at gmx.de
Sat Nov 23 07:46:18 EST 2002


"Lance" <lbrannma at cablespeed.com> wrote in message news:<utu5bo8fsqr1d2 at corp.supernews.com>...
> 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?
> 
> Thanks,
> Lance
That depends... Could you be more specific? Do you mean text output to
stdout?
Are you developing under windows or unix? On unix, you can simply
redirect the output to /dev/null, like
python myprogram.py > /dev/null
If you want to suppress the output direct in the program, than write a
custom output function that wraps the print statement or whatever you
use for output.
def output(s,testing=0):
    if(testing):
        pass
    else:
        print str(s)

Now you can turn output on or off via a global testing flag. 
Hope that helps!
Florian



More information about the Python-list mailing list