python - How to put special character between string -
this question has answer here:
- hexadecimal string byte array in python 8 answers
i have string "0013a200305eff96". want change in form "\x00\x13\xa2\x00\x30\x5e\xff\x96". special character "\x". how can in time efficient way?
python2
>>> "0013a200305eff96".decode("hex") '\x00\x13\xa2\x000^\xff\x96' python3
>>> bytes.fromhex("0013a200305eff96") b'\x00\x13\xa2\x000^\xff\x96'
Comments
Post a Comment