The commands module

(Unix only). This function contains a few convenience functions, designed to make it easier to execute external commands under Unix.

Example: Using the commands module
# File: commands-example-1.py

import commands

stat, output = commands.getstatusoutput("ls -lR")

print "status", "=>", stat
print "output", "=>", len(output), "bytes"

status => 0
output => 171046 bytes
 

[comment on/vote for this article]

A Django site. this page was rendered by a django application in 0.01s 2010-09-02 15:26:34.691178. hosted by webfaction.