OK, this works too.
I can't read. Sorry!
b'\53 is not the same as b'x53'Which function makes from '53006400C845' => b'\53\00\64\00\C8\45' or leastways from '53' => b'x53'?
Code: Select all
def foo(a):
a = iter(a)
res = ''
try:
while True:
res = ''.join((res, '\\x', next(a), next(a)))
except StopIteration:
pass
return res.encode()
answer = foo('53006400C845')
print(answer)
Code: Select all
b'\\x53\\x00\\x64\\x00\\xC8\\x45'
Code: Select all
>>> for x in range(5):
... print(chr(answer[x]))
...
...
\
x
5
3
\