how to get command output using python

Steven Harms thisdyingdream at gmail.com
Thu Aug 9 10:14:47 EDT 2007


In python it is quite easy:

import commands

status, output = commands.getstatusoutput("my command")
--------------------

status will be the return code of the command
output will be what the command displayed

-sjh
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://mail.python.org/pipermail/python-list/attachments/20070809/7fb280ac/attachment.html>


More information about the Python-list mailing list