Escape spaces in strings

Andrew Dalke dalke at dalkescientific.com
Thu May 12 22:48:17 EDT 2005


Florian Lindner wrote:
> 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)

It's best that you use the subprocess module and completely skip
dealing with shell escapes.  The module is standard with 2.4 but
you can get the module and use it for 2.2 or 2.3.

http://docs.python.org/lib/module-subprocess.html

http://cvs.sourceforge.net/viewcvs.py/*checkout*/python/python/dist/src/Lib/subprocess.py

				Andrew
				dalke at dalkescientific.com




More information about the Python-list mailing list