I am using crc-16 and libscrc library in python
I want to change the string into bytes
For example:
a = '32'
b = '45'
c = '54'
d = '78'
e = '43'
f = '21'
---------------------------- encode to -----------------------------------
Expected Outcome:
b'\x32\x45\x54\x78\x43\x21'
print(bytes([int(x, 16) for x in [a, b, c, d, e, f]]))- this gives your expected bytes. Although it looks different it is same bytes in value asb'\x32\x45\x54\x78\x43\x21'.print ("b'\\x" + '\\x'.join([a,b,c,d,e,f]) + "'")