Код: Выделить всё
>>> hex(0)
'0x0'
Код: Выделить всё
>>> bytes.fromhex(hex(0)[2:])
Traceback (most recent call last):
File "", line 1, in
ValueError: non-hexadecimal number found in fromhex() arg at position 1
>>> bytes.fromhex('00')
b'\x00'
Подробнее здесь: https://stackoverflow.com/questions/790 ... -two-digit