base64 and binascii
Encode binary data as text (Base64, hex) and back.
Easy
import base64, binascii
base64.b64encode(b"\x00\xff") # b'AP8='
binascii.hexlify(b"\x0a\x1b") # b'0a1b'
bytes.fromhex("0a1b")
Spotted a mistake or want to add detail? Suggest an improvement — Content Contributors' edits are reviewed by editors before they go live.
Discussion (0)
Sign in or join free to ask questions and discuss this topic.