bytes to hex python code example
Example 1: python hex to bytes string
hexadecimal_string = "AB"
byte_array = bytearray.fromhex(hexadecimal_string)
print(byte_array)
Example 2: bytearray to hex python
''.join('{:02x}'.format(x) for x in StringToBeConverted)