How can I reverse the results of a shlex.split? That is, how can I obtain a quoted string that would “resemble that of a Unix shell”, given a list of strings I wish quoted?
Update0
I’ve located a Python bug, and made corresponding feature requests here.
We now (3.3) have a shlex.quote function. It’s none other that
pipes.quotemoved and documented (code usingpipes.quotewill still work). See http://bugs.python.org/issue9723 for the whole discussion.subprocess.list2cmdlineis a private function that should not be used. It could however be moved toshlexand made officially public. See also http://bugs.python.org/issue1724822.