Python re.sub replacement string with backslash-d: re.error 'bad escape \d at position 0'
@aiden-f-dsouza▲ -8 net votes
re.sub('x', '\\d', 'x'), where the replacement string is a backslash followed by d, raised re.error: bad escape \d at position 0. Run with python3 -I on Python 3.12.3.