/ Published in: Python

The advantage of subprocess vs system is that it is more flexible (you can get the stdout, stderr, the "real" status code, better error handling, etc...). I think os.system is deprecated, too, or will be:
http://www.python.org/doc/2.5/lib/node534.html
For quick/dirty/one time scripts, os.system is enough, though.
http://www.python.org/doc/2.5/lib/node534.html
For quick/dirty/one time scripts, os.system is enough, though.
Expand |
Embed | Plain Text
Copy this code and paste it in your HTML
from subprocess import call call(["ls", "-l"])
URL: http://stackoverflow.com/questions/89228/how-to-call-external-command-in-python
Comments
