Help me understand how to escape a byte of octal value character

In the Python code below,

x = '\101\102\103'
print(x)

please explain clearly to me why the output is ABC.

101 base 8 is (1 Ɨ 82) + (0 Ɨ 81) + (1 Ɨ 80) = 64 + 0 + 1 = 65
which is A in ASCII or unicode.

1 Like

Iā€™d go along with decimal 65 being A in ASCII, but Unicode is hex, so U-0041. ASCII is pretty much outdated and Python 3 dropped it in favor of being full-on Unicode.