how to proccess the blank in the path on linux

Jeremy Sanders jeremy+complangpython at jeremysanders.net
Wed May 21 11:13:17 EDT 2008


A.T.Hofkamp wrote:

> Escape the space to prevent the shell from interpreting it as a word
> seperator. This of course also holds for all other shell meta characters,
> such as * [ ] \ > < & and a few others I probably have forgotten.

If the command was useful (unlike cd), it might be better to use subprocess
to launch it so that you don't need the escaping:

subprocess.call(['ls', '8000 dir'])

This avoids using the shell.

-- 
Jeremy Sanders
http://www.jeremysanders.net/



More information about the Python-list mailing list