Convert from ASCII string encoded in Hex to plain ASCII?
A slightly simpler solution:
>>> "7061756c".decode("hex")
'paul'
No need to import any library:
>>> bytearray.fromhex("7061756c").decode()
'paul'
>>> txt = '7061756c'
>>> ''.join([chr(int(''.join(c), 16)) for c in zip(txt[0::2],txt[1::2])])
'paul'
i'm just having fun, but the important parts are:
>>> int('0a',16) # parse hex
10
>>> ''.join(['a', 'b']) # join characters
'ab'
>>> 'abcd'[0::2] # alternates
'ac'
>>> zip('abc', '123') # pair up
[('a', '1'), ('b', '2'), ('c', '3')]
>>> chr(32) # ascii to character
' '
will look at binascii now...
>>> print binascii.unhexlify('7061756c')
paul
cool (and i have no idea why other people want to make you jump through hoops before they'll help).