Python equivalent to the perl `backtick` operator?

Michael Hudson mwh21 at cam.ac.uk
Wed Nov 17 13:14:10 EST 1999


"Kevin Howe" <khowe at performance-net.com> writes:

> How do you execute a program from python?
> 
> In Perl you would do it like this:
> 
>     $varName = `programName`;

import commands
varName = commands.getoutput("programName")

- or probably better -
 
result, varName  = commands.getstatusoutput("programName")

HTH,
Michael





More information about the Python-list mailing list