Если вы хотите преобразовать b '\ x61' в 97 или '0x61', вы можете попробовать следующее:
[python3.5]
>>>from struct import *
>>>temp=unpack('B',b'\x61')[0] ## convert bytes to unsigned int
97
>>>hex(temp) ##convert int to string which is hexadecimal expression
'0x61'
Ссылка: https://docs.python.org/ 3,5 / библиотека / struct.html