Best way to capture output of another command-line program in Win32?

billie mlist at fastwebnet.it
Mon Feb 6 19:07:19 EST 2006


Another way:

>>> import popen2
>>> exec_cmd = popen2.popen4('dir')
>>> output = exec_cmd[0].read()
>>> print output
[...]
04/02/2006  21.44               106 setup.py
06/02/2006  23.25               656 time_synch.py
07/02/2006  00.52            16.885 knockd.log
07/02/2006  00.35             6.376 conf.pyc
[...]






More information about the Python-list mailing list