Hi I'm learning pySerial module, so the hex to ascii is its fundamental.
So far I have the following concepts.
Byte String: "\xde"
Byte Array:
>>> bytearray('\xde')
bytearray(b'\xde')
>>> a = bytearray('\xde')
>>> a[0]
222
>>> hex(a[0])
'0xde'
Hex String: '\xde'
Hex: 0xde
Normal representation: de
Now what I need is Hex String to Hex and vice versa.
Also Hex or Hex String to Normal representation .
I wish I can have the simplest possible answer.
Update:
I think I got an initial answer other than string operation. But this looks really dirty.
>>> hex(int(binascii.hexlify('\xde'),16))
'0xde'