binascii.unhexlify()
binascii.unhexlify() is a Python function in the Binascii Module category. Converts hexadecimal representation back to bytes. The syntax is binascii.unhexlify(hexstr). Parameters: hexstr — hex bytes/string. Returns: Bytes. A typical example: binascii.unhexlify(b"68656c6c6f") # b"hello". A close sibling is binascii.hexlify(), which converts bytes to hexadecimal representation (like bytes.hex()). A close sibling is binascii.crc32(), which computes CRC-32 checksum of data (for error detection, not security). A close sibling is binascii.a2b_base64(), which converts base64 ASCII string to bytes (alternative to base64.b64decode). A close sibling is binascii.b2a_base64(), which converts bytes to base64 ASCII string. More about this category: Binary data conversions — hexlify, unhexlify, crc32, base64. Related Binascii Module entries: binascii.hexlify(), binascii.crc32(), binascii.a2b_base64(), binascii.b2a_base64(). This page is part of the free Python Reference documentation covering 978+ functions, methods, and modules with examples and parameter details. You can try binascii.unhexlify() immediately in the Python playground, look up unfamiliar terms in the glossary, or return to the Python Reference homepage.