Executing external programs with vars

Michael Hudson mwh21 at cam.ac.uk
Fri Feb 4 04:48:49 EST 2000


Mike Partin <wking at sheltonbbs.com> writes:

> Hi, I'm relativly new to python as a language, I started trying to
> pick it up to implement a shell script I have done for helping with
> CVS use. I'm not having problems executing external programs per
> say, it's that I'm having problems executing them and including
> variables. For example, when updating a cvs module I set my variable
> TempVar with raw_input() then when I exec cvs I need it to be in the
> form "cvs -z3 co TempVar" but can't seem to get this to work. Any
> help would be appreciated.

Hmm, I feel like I'm attempting telepathy, but is this what you want?

def hopefully_help_mike():
    module = raw_input("Enter module to check out: ")
    os.system("cvs -z3 co %s"%module)

HTH,
Michael



More information about the Python-list mailing list