Answers for "turn string into hex bytes python"

0

python hex to bytes string

hexadecimal_string = "AB"
byte_array = bytearray.fromhex(hexadecimal_string)
print(byte_array)
Posted by: Guest on December-16-2020
5

python string to hex

hex_string = "0xAA"
# "0x" also required

an_integer = int(hex_string, 16)
# an_integer is a decimal value

hex_value = hex(an_integer)
print(hex_value)
Posted by: Guest on July-14-2020

Code answers related to "turn string into hex bytes python"

Python Answers by Framework

Browse Popular Code Answers by Language