Serhiy Storchaka added the comment: There is a problem with your replacement template. Python string literal '\\' is Python string containing a single backslash character. But backslash has special meaning in a replacement template, it starts escapes and backreferences. For using a literal backslash, it should be escaped: r'\\' or '\\\\'.
>>> re.sub(pat, r'\\', path) 'd:\\temp\\' ---------- nosy: +serhiy.storchaka resolution: -> not a bug stage: -> resolved status: open -> closed _______________________________________ Python tracker <rep...@bugs.python.org> <http://bugs.python.org/issue29015> _______________________________________ _______________________________________________ Python-bugs-list mailing list Unsubscribe: https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com