2

I have a list of Hex value variables in my python code.

I need to convert into ASCII string.

Can someone please suggest to me, how to convert it?

HexList = ['0x0', '0x30', '0x32', '0x31', '0x30', '0x42', '0x32', '0x33', '0x38', '0x30', '0x30', '0x30', '0x31', '0x30', '0x32','0x43','0x30']

Expected value of Ascii string after the conversion= 0210B238000102C0

snakecharmerb
  • 47,570
  • 11
  • 100
  • 153
Raj
  • 151
  • 1
  • 14
  • The output can be reproduced by doing something like `''.join(chr(int(c, 16)) for c in HexList[1:])` – Heike Oct 07 '19 at 09:57
  • 1
    Possible duplicate of [Convert from ASCII string encoded in Hex to plain ASCII?](https://stackoverflow.com/questions/9641440/convert-from-ascii-string-encoded-in-hex-to-plain-ascii) – Corsaka Oct 07 '19 at 10:17
  • why did you start the index from 1 instead of 0 in HexList? – Raj Oct 07 '19 at 10:17
  • 0x0 doesn't do anything. – Corsaka Oct 07 '19 at 10:18
  • Specific duplicate answer: `bytearray.fromhex("70 61 75 6C").decode()` where 70 61 75 6C can be replaced – Corsaka Oct 07 '19 at 10:19

0 Answers0