how to call shell?

Tim Roberts timr at
Tue Feb 12 06:43:38 CET 2013

contro opinion <contropinion at> wrote:
>>>> import os
>>>> os.system("i=3")
>>>> os.system("echo $i")
>why i can't get the value of i ?

Each invocation of os.system creates a brand new shell that starts, runs,
and terminates.  Your first command adds a variable "i" to the environment
for that shell, but the variable is deleted when the shell procsess
Tim Roberts, timr at
Providenza & Boekelheide, Inc.

More information about the Python-list mailing list