On Sun, Jun 19, 2005 at 11:12:05PM -0700, Didier C wrote: > Hi! > I was wondering if we can pass some arguments to system("cmdline")? > > E.g in Perl, we can do something like: > > $dir="/home/cypher"; > > system("ls $dir"); > > which would instruct Perl to do an "ls /home/cypher" > > But in python, doing something like > > dir="/home/cypher" > system("ls dir") system("ls %(dir)s" % locals()) system("ls %s" % dir) system("ls %(name)s" % dict(name=dir)
But you should consider if you really really want to do this. What happens when " " in dir? What happens when dir == "; rm -Rf /" Andreas -- http://mail.python.org/mailman/listinfo/python-list