call shell from python

Chris Rebert clp2 at
Tue Feb 12 06:29:28 CET 2013

On Mon, Feb 11, 2013 at 9:13 PM, contro opinion <contropinion at> wrote:
>>>> import os
>>>> os.system("i=3")
> 0
>>>> os.system("echo $i")
> 0
> how can i get the value of  i?

Your example is too heavily contrived for me to give a much more
specific/useful answer than "use the `subprocess` module":

Of course, if all you want to do is manipulate environment variables,
then there's `os.environ`:

Good luck, my pseudonymous contrarian compadre.
– Chris

More information about the Python-list mailing list