I've seen a lot of posts about this subject but I haven't found the solution I'm looking for (despite lot of attempts ...). In a nutshell, when migrating one of my libraries from Python2 to 3, whose main data model is based on hex strings like this '\xaa\xbb\xcc' (string length=3) I've encountered the (by now) known issue with the usage of binascii.a2b_hex('aabbcc') function, which gives '\xaa\xbb\xcc' in Python2 and b'\xaa\xbb\xcc' in Python3. Being the whole library based on this data model, including external libraries using it, it will take a lot of time to review the code line by line to migrate it to the bytes data model. In conclusion, I'm looking for a Python3 function doing the translation, i.e. b'\xaa\xbb\xcc' -> '\xaa\xbb\xcc' (string length=3) or 'aabbcc' -> '\xaa\xbb\xcc' (string length=3) many thanks in advance!
tried all hex()/binascii.hexlify()/format