Éric Araujo wrote:
In my case, I was building up a command line to pass as a single string
to subprocess, and needed a way to quote the args explicitly. That's
why I went looking at this.
FYI, if you need the reverse operation (string → list), look at shlex.
Keep in mind that these routines typically only work on Unix-like
systems, where the shell has a set of well defined rules for quoting and
parsing. On Windows, each executable is in charge of parsing its own
parameters from a string. This is usually (but certainly not always)
done by the C runtime startup. But different runtimes have different
rules. Sadly, you sometimes have to know which executable you're calling
before you can know how to escape its arguments.
--
Eric.
_______________________________________________
stdlib-sig mailing list
stdlib-sig@python.org
http://mail.python.org/mailman/listinfo/stdlib-sig