remove a directory with special chars

Peter Hansen peter at engcorp.com
Sun Mar 19 20:33:22 CET 2006


andy wrote:
> Is there a special reason you want to use Python to do this?  The Linux
> command shell would probably do exactly the same job (you can specify
> backslash-escaped characters at the command-line)...
> 
> anyway to do it in python:
> 
>   import os
>   os.remove("/path/to/the/file/.\177\177")
> 
> Note that under Linux, hidden files start with a "." - that's what makes
> them hidden.
> 
> By the way, "\177" (decimal 79) is a letter "O"... I suspect you meant
> "\011" (decimal 9) which is backspace...

Actually, \177 is DEL, while the letter O is \117.

Definitely confusing, but then octal sucks anyway.

-Peter




More information about the Python-list mailing list