I have the following two vars:
a = chr(92) + 'x11'
b = '\x11'
print 'a is: ' + a
print 'b is: ' + b
The result of these print statemtents:
a is: \x11
b is: <| # Here I am just showing a representation of the symbol that is printed for b
How can I make it so that variable a prints the same thing as var b using the chr(92) call? Thank you in advance.
The other answers are showing you how to make
bgive you what you get ina. If you wantato give you what you get inb(which is what you’re asking, if I read you correctly), you need to decode the escape sequence:You can also use
unicode-escapeinstead ofstring-escapeif you want a unicode string as the result.