February 2006
Intermediate to advanced
648 pages
14h 53m
English
The commands module is used to execute system commands as a string and return their output as a string. This module is only available on UNIX systems.
getoutput(cmd)
Executes cmd in a shell and returns a string containing both the standard output and standard error streams of the command.
getstatus(filename)
Returns the output of 'ls -ld filename' as a string.
getstatusoutput(cmd)
Like getoutput(), except that a 2-tuple (status, output) is returned, where status is the exit code, as returned by the os.wait() function, and output is the string returned by getoutput().
mkarg(str)
Turns str into an argument that can be safely used within a command string (using quoting rules of the shell).
The os.popen2() call is used to execute ...