On Jan 28, 10:20 am, Joan Miller <pelok...@gmail.com> wrote: > I've to call to many functions with the format: > > >>> run("cmd") > > were "cmd" is a command with its arguments to pass them to the shell > and run it, i.e. > > > > >>> run("pwd") > or > >>> run("ls /home") > > Does anybody knows any library to help me to avoid the use of the main > quotes, and brackets? > > I would to use anything as: > > $ ls /home => run("ls /home") > > or, at least > > run pwd => run("pwd")
How about this? def pwd(): return run("pwd") pwd() def ls(l=False, files=()): args = [] if l: args.insert(0, '-l') args.append(files) return run("ls", args) ls(l=True, "/foo") -- http://mail.python.org/mailman/listinfo/python-list