In Python I'm trying to print out the character corresponding to a given code like this:
a = 159
print unichr(a)
It prints out a strange symbol. Can anyone explain why?
In Python I'm trying to print out the character corresponding to a given code like this:
a = 159
print unichr(a)
It prints out a strange symbol. Can anyone explain why?
#To get numerical value of string. This gives me 49.
ord("1")
#To get string from numerical value. This gives me "1".
chr(49)
It is possible that the numerical value that you're trying to convert to a digit is the representative of a special character, in which case it is likely that python converted it into it's hex equivalent. To see the hex value of an integer:
hex(ord("1"))
If that is not the case, it's possible that it used another representative, since it is(hypothetically) a special character.
The character at unicode 159 is an Application Program Command. It's a control character, and is deemed not a graphic character.