redirecting print to a a file
Sybren Stuvel
sybrenUSE at YOURthirdtower.com.imagination
Thu May 11 08:58:17 EDT 2006
AndyL enlightened us with:
> Can I redirect print output, so it is send to a file, not stdout.
Change sys.stdout to a file object.
> I have a large program and would like to avoid touching hundreds of
> print's.
I can suggest using the logging module instead of print. It's much
more flexible than prints, and well suited for large programs.
Sybren
--
The problem with the world is stupidity. Not saying there should be a
capital punishment for stupidity, but why don't we just take the
safety labels off of everything and let the problem solve itself?
Frank Zappa
More information about the Python-list
mailing list