capturing the output of external commands

Phil Frost indigo at bitglue.com
Sun Jul 25 17:09:47 CEST 2004


See the standard 'commands' module. If that doesn't fit your needs, you
can capture the output directly with os.popen.

On Sun, Jul 25, 2004 at 02:51:06PM +0000, Avi Kak wrote:
> 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