> I forgot you need to escape special characters in the arguments. You
> can add quoting and escape special characters at the same time with
> the undocumented function pipes.quote:
>
>     import pipes
>
>     args = tuple(pipes.quote(arg) for arg in (arg1, arg2, arg3))
>     cmd = 'python test.py %s %s %s' % args
>
> Notice there are no longer quotes around each %s in cmd. Python 3.3
> will have shlex.quote:
>
> http://docs.python.org/dev/library/shlex.html#shlex.quote

Why is ``pipes.quote`` undocumented? It's useful.

-Modulok-
_______________________________________________
Tutor maillist  -  Tutor@python.org
To unsubscribe or change subscription options:
http://mail.python.org/mailman/listinfo/tutor

Reply via email to