[issue19844] os.path.split fails on windows path
Christian Heimes
report at bugs.python.org
Sat Nov 30 18:18:50 CET 2013
Christian Heimes added the comment:
Ah, you fell victim to a classic gotcha. :)
Either you have to quote \ with \\ or you have to use a raw string. Withouth a raw string \t is TAB and \01 is the byte \x01:
>>> import ntpath
>>> fname = r"C:\progs\python\test\target\Amy Winehouse\Amy Winehouse - Back To Black (2006)\01 - Rehab.ogg"
>>> ntpath.split(fname)
('C:\\progs\\python\\test\\target\\Amy Winehouse\\Amy Winehouse - Back To Black (2006)', '01 - Rehab.ogg')
>>> len("\01")
1
>>> "\01" == chr(1)
True
>>> len(r"\01")
3
----------
nosy: +christian.heimes
status: open -> closed
_______________________________________
Python tracker <report at bugs.python.org>
<http://bugs.python.org/issue19844>
_______________________________________
More information about the Python-bugs-list
mailing list