Convert Hex to Bytes in Python
Last modified: 2023-09-04
Conversion
Using bytes.fromhex
method, we can convert hex string to bytes string.
hex_str = "48656c6c6f20576f726c64"
bytes.fromhex(hex_str)
# b'Hello World'
Last modified: 2023-09-04
Using bytes.fromhex
method, we can convert hex string to bytes string.
hex_str = "48656c6c6f20576f726c64"
bytes.fromhex(hex_str)
# b'Hello World'