Redirect DOS command output

daryl_stultz at my-deja.com daryl_stultz at my-deja.com
Thu Feb 10 19:56:10 CET 2000


In article <87ura9$ib0$1 at nnrp1.deja.com>,
  daryl_stultz at my-deja.com wrote:
> Hey, I'm using os.system() to execute a DOS command (on an NT
machine).

After doing some more research, I came across win32pipe.popen() and that
did the trick.

*******
import win32pipe

output = win32pipe.popen("dir", "r")
print output.read()
*******

Just out of curiosity, is there a cross platform way to do the above?
Maybe using os.pipe ? thanks


Sent via Deja.com http://www.deja.com/
Before you buy.



More information about the Python-list mailing list