More random python observations from a perl programmer
Barry A. Warsaw
bwarsaw at cnri.reston.va.us
Wed Sep 15 10:33:28 EDT 1999
>> I find `print' very convenient. I would find it more
>> convenient if there were a way for it to print to stderr,
>> though.
When I find I need to print a lot of stuff to stderr, I use the
following idiom:
sys.stdout = sys.stderr
try:
# lots of print statements
# maybe even a function with lots of print statements
finally:
sys.stdout = sys.__stdout__
-Barry
More information about the Python-list
mailing list