Fix Python – Convert from ASCII string encoded in Hex to plain ASCII?

Question

Asked By – Paul Reiners

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

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

Now we will see solution for issue: Convert from ASCII string encoded in Hex to plain ASCII?


Answer

A slightly simpler solution:

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

This question is answered By – cjm

This answer is collected from stackoverflow and reviewed by FixPython community admins, is licensed under cc by-sa 2.5 , cc by-sa 3.0 and cc by-sa 4.0