Escape spaces in strings

Jp Calderone exarkun at divmod.com
Thu May 12 16:58:37 EDT 2005


On Fri, 13 May 2005 00:49:21 +0200, Florian Lindner <florian.lindner at xgm.de> wrote:
>Hello,
>is there a function to escape spaces and other characters in string for
>using them as a argument to unix command? In this case rsync
>(http://samba.anu.edu.au/rsync/FAQ.html#10)
>
>Thx,
>
>Florian

  Yes, but you don't want to use them.  Instead, use a process launching function which doesn't smoosh arguments together into a single string which then needs to be parsed.  For example, os.execl, os.spawnl, or subprocess.call.

  Jp



More information about the Python-list mailing list