I have a list of hex that I would like to transform into a list of unicode characters. Everything here is done with python-3.5.
If I do print(binary.fromhex('hex_number').decode('utf-8'))
it works. But does not work if, after the conversion, I store, again, the chars in the list:
a = ['0063'] # Which is the hex equivalent to the c char.
b = [binary.fromhex(_).decode('utf-8') for _ in a]
print(b)
will print
['\x00c']
instead of
['c']
while the code
a = ['0063']
for _ in a:
print(binary.fromhex(_).decode('utf-8'))
prints, has expected:
c
Can someone explain to me how I can convert the list ['0063']
in the list ['c']
and why I get this strange (to me) behavior?
To see what the 0063
hex corresponds look here.