Python str.translate() changed behaviour

That is the repr of the value you are seeing.
Try both these to see the difference:


x = ‘a#b'.translate(str.maketrans({'#': r'\#'}))
print(x)
print(repr(x))