[issue31101] os.remove() auto add \ in Windows2012R2

Paul Moore report at bugs.python.org
Wed Aug 2 03:42:15 EDT 2017


Paul Moore added the comment:

There are two problems with your code and bug report:

1. By using a single quoted string, some of the backslashes in the path are being interpreted as starting a special character (specifically \t is interpreted as a tab character). You should either double the backslashes to prevent this interpretation (dir_path='d:\\c\\d\\e\\t\\c\\t.xf'), use forward slashes (dir_path='d:/c/d/e/t/c/t.xf') or use a raw string (dir_path=r'd:\c\d\e\t\c\t.xf').

2. You're reporting that Python "auto adds \". It doesn't, it's just that the repr of the string shows a single quoted string with backslashes doubled - that's the standard repr for strings.

So, Python is behaving as expected, and there's no bug here.

----------
resolution:  -> not a bug
stage:  -> resolved
status: open -> closed

_______________________________________
Python tracker <report at bugs.python.org>
<http://bugs.python.org/issue31101>
_______________________________________


More information about the Python-bugs-list mailing list