[Newbie] Python as a frontend to other apps.

Sami Hangaslammi shang.remove_edu at st.jyu.fi.edu
Mon Jan 24 02:19:12 EST 2000


Patrick H. Mullins <pmullins at gatecom.com> wrote in message
news:pgLi4.25161$pb2.1983916 at tw11.nn.bcandid.com...
> > import os
> > password="secretstuff"
> > infile="test.idea"
> > outfile="test.zip"
> > os.system("idea -dk %(password) %(infile) %(outfile)")
>
> Found out that I just had to move a few things around.  :-)
>
> os.system("idea -dk %s %s %s" % (password, infile, outfile))

You could use your original syntax with a few small additions, i.e.

os.system("idea -dk %(password)s %(infile)s %(outfile)s" % vars())

You have add the format specifier 's' (string) after the variable name
or you'll get an 'incomplete format' error. Also, you must provide a
dictionary that contains the variables (returned by vars() ).

--
Sami Hangaslammi
shang (at) st (dot) jyu (dot) fi





More information about the Python-list mailing list