Aim: to open a text file, read its hexadecimal contents, convert each hexadecimal line to ascii, print ascii code.
Assume binascii module imported
my code: code=txt.read().replace('\n', '').replace('\r', '').replace(' ', '')
code.strip()
for chunk in code:
print(binascii.unhexlify(chunk))
Output: binascii.Error: Odd-length string
How do I fix this? Why are 'strip' and 'replace' insufficient?