capturing the output of external commands

Avi Kak kak at purdue.edu
Sun Jul 25 18:41:42 CEST 2004



Thanks, Phil.  The function commands.getoutput()
is exactly what I was looking for.

Avi




On Sun, 25 Jul 2004 11:09:47 -0400, Phil Frost <indigo at bitglue.com>
wrote:

>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