capturing the output of external commands

Avi Kak kak at purdue.edu
Sun Jul 25 10:51:06 EDT 2004



Is there a Python function in any of the
standard-distribution modules that does 
what the backticks do in Perl?

I want to run an external command and I'd
like its output to be captured directly 
in my Python script in the form of a string
object.

The function os.system() or any of the
os.exec functions do not work for what I 
have in mind because they do not capture
and return in Python the output produced
by the commands supplied to them as 
arguments.

Avi Kak
kak at purdue.edu




More information about the Python-list mailing list