print to stdout and to a log file.....

Ralph Corderoy ralph at inputplus.demon.co.uk
Mon Aug 21 10:21:25 EDT 2000


> If I have a command
> os.system("program.exe %s %s" %(file1,file2))
> how can I capture the output of this execution to both stdout and to
> a lets say log file.....

That's more of a Unix question than Python;  have you tried tee(1)?

    >>> os.system("date | tee date.out; wc date.out; rm date.out")
    Mon Aug 21 15:20:32 BST 2000
          1       6      29 date.out
          0


Ralph.




More information about the Python-list mailing list