how to stop info output on screen

Steve Holden steve at holdenweb.com
Fri Sep 30 15:03:00 CEST 2005


midday.hu at gmail.com wrote:
> Hi,
> 
> Does someone know how to stop "the information output on screen"? Now
> when I run my code, it outputs a lot of message when calling other
> libraries, together with the info with the print command I used.
> 
> How can I mask these info on screen when calling other libraries and
> how I can mask the info output produced by the print command? Is there
> a way to mask them separately.
> 
> Thanks a lot if anyone knows it.
> 
> Kind regards of your help
> Midday
> 
Since you appear to be adding your own code, with your own print 
statements, to an existing Python program the easiest thing to do is 
make sure your own code writes to a place of your choice. This is most 
easily done with

   myFile = open("myfile.txt", "w")
     ...
   print >> myFile, this, that, the other
     ...
   print >> myFile, moreStuff(things)
     ...
   myFile.close()

regards
  Steve
-- 
Steve Holden       +44 150 684 7255  +1 800 494 3119
Holden Web LLC                     www.holdenweb.com
PyCon TX 2006                  www.python.org/pycon/




More information about the Python-list mailing list