I have the following where I need s1 to be in hexes, but not necessarily printable characters. I use join to make them like \x42\x42\x42\x42.
s1 = '42424242'
s2 = "\\x".join(s1[i:i + 2] for i in range(len(s1), -2, -2))
s3 = "AAAA"
print(s3 + s2)
When I print it out, it currently prints as AAAA\x42\x42\x42\x42
, but I need it to be AAAABBBB
. Anyone help?
edit: I am not able to use binascii for this case.