passing Python assignment value to shell

John Gordon gordon at panix.com
Wed May 28 17:40:14 EDT 2014


In <mailman.10422.1401310723.18130.python-list at python.org> Satish Muthali <satish.muthali at gmail.com> writes:

> Now I want to feed the value for 'freecalc_total' as an argument to
> a command executed by the shell.

> For example:

> devnull = open(os.devnull, 'w')
> runCommand = subprocess.call(['stressapptest', '<I want to pass
> the value of freecalc_total here>'], stdout=devnull,stderr=subprocess.STDOUT)
> devnull.close()

I think you can just include freecalc_total directly as part of the
argument list, like this:

    runCommand = subprocess.call(['stressapptest', freecalc_total], 
        stdout=devnull, stderr=subprocess.STDOUT)

-- 
John Gordon         Imagine what it must be like for a real medical doctor to
gordon at panix.com    watch 'House', or a real serial killer to watch 'Dexter'.




More information about the Python-list mailing list