capturing output from os.system() in Windows?

Alex Martelli aleax at aleax.it
Wed Apr 23 04:34:36 EDT 2003


David wrote:

> os.system('NET VIEW') returns 0 under windows, although the DOS box
> pops up and the NET VIEW executes correctly.
> 
> Is there some other command I should be using instead? I guess an

Yes, os.popen('NET VIEW') should serve your needs -- it returns a
filelike object, open for reading, with the output of 'NET VIEW'.


Alex





More information about the Python-list mailing list