hex:用来将bytes的值转换为hexstr:
>>> bytes([0,1,2]).hex()
'000102'
fromhex:用来将hexstr的值转换为bytes:
>>> bytes.fromhex("000102")
b'\x00\x01\x02'
版权声明:本文为qq_44555121原创文章,遵循CC 4.0 BY-SA版权协议,转载请附上原文出处链接和本声明。
hex:用来将bytes的值转换为hexstr:
>>> bytes([0,1,2]).hex()
'000102'
fromhex:用来将hexstr的值转换为bytes:
>>> bytes.fromhex("000102")
b'\x00\x01\x02'