hexstring to string?
Gerhard Häring
gh_pythonlist at gmx.de
Thu Mar 7 13:06:55 EST 2002
Le 07/03/02 à 17:32, maximilianscherr écrivit:
> i made a function to convert a hex string containing character to a
> normal string.
>
> it looks like this:
>
> class ConversionHandler:
> def ConvertHexToStr(self, hex):
> letter = 0
> str = ''
> while len(str) < len(hex) / 2:
> nextletter = letter + 2
> str = str + chr(int(hex[letter:nextletter], 16))
> letter = nextletter
>
> return str
>
> hex looks like: 414243
>
> but why does it not work?
It does work correctly. Btw. you could have just used binascii.unhexlify
from the Python standard library.
Gerhard
--
This sig powered by Python!
Außentemperatur in München: 10.3 °C Wind: 5.5 m/s
More information about the Python-list
mailing list