Convert from ASCII string encoded in Hex to plain ASCII?

Paul Reiners picture Paul Reiners · Mar 9, 2012 · Viewed 467.6k times · Source

How can I convert from hex to plain ASCII in Python?

Note that, for example, I want to convert "0x7061756c" to "paul".

Answer

cjm picture cjm · Mar 9, 2012

A slightly simpler solution:

>>> "7061756c".decode("hex")
'paul'