markot...@gmail.com wrote:

> print("Key-" + str(võti) + ": " + str(unhexlify("".join(tulemus))))
> 
> IM getting this error on this line. This is the print line of a decryption
> program. I wanti it to convert the tulemus which is in HEX to ASCII so i
> could read it. I could use online translators for the line, but since i
> have 255 lines of the HEX codes, it would be higly unefficient.
> 
> How to i fix the Oddlenght string?

My crystal ball says: strip off the newline byte:

>>> unhexlify(tulemus)
Traceback (most recent call last):
  File "<stdin>", line 1, in <module>
binascii.Error: Odd-length string
>>> unhexlify(tulemus.rstrip(b"\n"))
b'whatever'


-- 
https://mail.python.org/mailman/listinfo/python-list

Reply via email to