Amaury Forgeot d'Arc added the comment: Anatoly, your last question about re.sub is covered by the documentation: re.sub will process the replacement string, and interpret the sequence \ 0 as the NUL character. So you get the NUL character in the returned string.
This is unrelated to raw literal strings. And yes, sometimes you need 4 backslashes to get one in the output: >>> print(re.sub("b", "\\\\", "abc")) a\c ---------- nosy: +amaury.forgeotdarc _______________________________________ Python tracker <rep...@bugs.python.org> <http://bugs.python.org/issue17426> _______________________________________ _______________________________________________ Python-bugs-list mailing list Unsubscribe: http://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com