bytes对象的hex和fromhex
bytes对象的hex函数,用来将bytes对象的值转换成hexstr;
而fromhex函数,用来将hexstr导入bytes对象;
>>> str_hex = bytes.fromhex('a4007893')
>>> str_hex
b'\xa4\x00x\x93'
>>> type(str_hex)
<class 'bytes'>
>>>
>>>
>>> hh = bytes([0xa4,00,78,93]).hex()
>>> hh
'a4004e5d'
>>> type(hh)
<class 'str'>