hexadecimal_string = "AB" byte_array = bytearray.fromhex(hexadecimal_string) print(byte_array)
#Hex -> Bytes >>> b'xdexadxbexef'.hex() 'deadbeef' #Bytes -> Hex >>> bytes.fromhex('deadbeef') b'xdexadxbexef'