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 bac
New submission from Сергей Снегирёв:
>>> path
'd:/\\temp'
>>> pat = '[{}]+'.format(re.escape('\\/'))
>>> re.sub(pat, '\\', path)
Traceback (most recent call last):
File "", line 1, in
re.sub(pat, '\\', path)
File "C:\Users\Сергей\AppData\Local\Programs\Python\Python35\lib\re.py", lin