On this page
binascii.unhexlify
Prev: binascii.Incomplete | Up: binascii
Rel: binascii.a2b_base64, binascii.a2b_hex, binascii.a2b_qp, binascii.a2b_uu
Ref: docs.python.org — binascii.unhexlify
Tags: #public #python3 #stdlib #binascii
Import
import binascii
from binascii import unhexlify
Signature & Overview
binascii.unhexlify(hexstr, /)
Binary data of hexadecimal representation.
Usage
import binascii
assert binascii.unhexlify("deadbeef") == b"\xde\xad\xbe\xef"
Gotchas
- Rejects whitespace and odd lengths: Use
bytes.fromhex()if your hex string contains spaces.
REPL Inspect
from binascii import unhexlify
help(unhexlify)
Linked from
Related notes
- tuts/python3/stdlib_module/binascii/Incomplete Linked here; links to this page; shared tags: #binascii, #stdlib
- tuts/python3/stdlib_module/binascii Linked here; links to this page; shared tags: #stdlib
- tuts/python3/stdlib_module/binascii/a2b_base64 Linked here; shared tags: #binascii, #stdlib
- tuts/python3/stdlib_module/binascii/a2b_hex Linked here; shared tags: #binascii, #stdlib
- tuts/python3/stdlib_module/binascii/a2b_qp Linked here; shared tags: #binascii, #stdlib
- tuts/python3/stdlib_module/binascii/a2b_uu Linked here; shared tags: #binascii, #stdlib
- tuts/python3/stdlib_module/binascii/b2a_base64 shared tags: #binascii, #stdlib
- tuts/python3/stdlib_module/binascii/b2a_hex shared tags: #binascii, #stdlib
- tuts/python3/stdlib_module/binascii/b2a_qp shared tags: #binascii, #stdlib
- tuts/python3/stdlib_module/binascii/b2a_uu shared tags: #binascii, #stdlib