Write both in std output and in a file ?

Jonathan Gardner jgardn at alumni.washington.edu
Thu Jan 17 06:37:59 EST 2002


On Wednesday 16 January 2002 06:54 pm, Barghest wrote:
> Hello,
> Is it possible to print output both in the console and in a file ?
>
> Python 2.1

This must be a windows guy.

If you were using a Real Operating System (TM)[*], you would realize that you 
can implement this from the command line:

$ python <my program>.py | tee <the file>

One more reason why I can never go back to windows, and why I use the command 
line and not some GUI.

Jonathan

[*] Real Operating Systems (TM) come with a C compiler. It is not an 
optional, expensive component.

DISCLAIMER: Any offense is *purely* intentional. If you are serious about 
programming, stop using Windows. It is buggy, it is under-featured, and it is 
a security threat to you, your job, your boss, your company, your children, 
and to the future of the internet. What's that you say? You can't switch to 
Linux because of your job? You might want to find a real job, and stop 
playing with your Legos and Lincoln Logs.

DOUBLE DARE-YOU DISCLAIMER: I don't hate you. No, really. If I hated you, I 
wouldn't have told you about the "tee" program that comes default with every 
real operating system.




More information about the Python-list mailing list