I am trying to print ascii or an extended ascii character. using this code:
print '\xff'.decode('latin-1')
it will print ascii # 255, but now I want to enter using a decimal number as follows:
num=255
myhex=hex(num)
print myhex.decode('latin-1')
Coz myhex is '0xff' does not work, so I need to convert to '\ xff'. replacing "0x" with "\ x" gives me an error.
myhex.replace('0x','\x')
will give me an error: ValueError: invalid \ x escape
How to solve the problem? can anyone help? the target I want to print char β ΓΏ in the terminal / console.
andio source
share