Can we pass some arguments to system("cmdline")?

Didier C elprodigio at gmail.com
Mon Jun 20 02:12:05 EDT 2005


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")

would cause python to execute "ls dir" where "dir" might not exist at
all! Is there a way to reproduce the same thing in Python?

Thanks for any insights.

cheers,
Didier.




More information about the Python-list mailing list