redirecting print to a a file

AndyL ask at me
Thu May 11 14:16:04 CEST 2006


Sybren Stuvel wrote:
> AndyL enlightened us with:
> 
>>And what if I want to still send the output to stdout and just a log
>>it in the file as well?
> 
> 
> $ python some_program.py | tee output.log
> 
> Or write a class that has a write() function and outputs to a file and
> to the original value of sys.stdout (IIRC that's in sys.__stdout__)
> 
> Sybren

Thx again. Python is cool, do that in C++ or Java :-)

A.



More information about the Python-list mailing list