obtain the output of an external program

Miki Tebeka mikit at zoran.co.il
Mon Nov 17 10:36:10 EST 2003


Hello Fernando,

> How can I save the output of an external program, called with os.system()?
1. Redirect the output of the program to a file (using "> fname" in
the system command) and read it later. Be aware that stderr is not
captured this way.
2. Use os.popen and variants.

IMO option 2 is better.

HTH.
Miki




More information about the Python-list mailing list