Back to module index
Go to module by name
binascii
Conversion between binary data and ASCII
Classes
Error
with_traceback(...)
Exception.with_traceback(tb) --
set self.__traceback__ to tb and return self.
args = <attribute 'args' of 'BaseException' objects>
Incomplete
with_traceback(...)
Exception.with_traceback(tb) --
set self.__traceback__ to tb and return self.
args = <attribute 'args' of 'BaseException' objects>
Functions
a2b_base64
a2b_base64(data, /)
Decode a line of base64 data.
a2b_hex
a2b_hex(hexstr, /)
Binary data of hexadecimal representation.
hexstr must contain an even number of hex digits (upper or lower case).
This function is also available as "unhexlify()".
a2b_hqx
a2b_hqx(data, /)
Decode .hqx coding.
a2b_qp
a2b_qp(data, header=False)
Decode a string of qp-encoded data.
a2b_uu
a2b_uu(data, /)
Decode a line of uuencoded data.
b2a_base64
b2a_base64(data, /, *, newline=True)
Base64-code line of data.
b2a_hex
b2a_hex(...)
Hexadecimal representation of binary data.
sep
An optional single character or byte to separate hex bytes.
bytes_per_sep
How many bytes between separators. Positive values count from the
right, negative values count from the left.
The return value is a bytes object. This function is also
available as "hexlify()".
Example:
>>> binascii.b2a_hex(b'\xb9\x01\xef')
b'b901ef'
>>> binascii.hexlify(b'\xb9\x01\xef', ':')
b'b9:01:ef'
>>> binascii.b2a_hex(b'\xb9\x01\xef', b'_', 2)
b'b9_01ef'
b2a_hqx
b2a_hqx(data, /)
Encode .hqx data.
b2a_qp
b2a_qp(data, quotetabs=False, istext=True, header=False)
Encode a string using quoted-printable encoding.
On encoding, when istext is set, newlines are not encoded, and white
space at end of lines is. When istext is not set, \r and \n (CR/LF)
are both encoded. When quotetabs is set, space and tabs are encoded.
b2a_uu
b2a_uu(data, /, *, backtick=False)
Uuencode line of data.
crc32
crc32(data, crc=0, /)
Compute CRC-32 incrementally.
crc_hqx
crc_hqx(data, crc, /)
Compute CRC-CCITT incrementally.
hexlify
hexlify(...)
Hexadecimal representation of binary data.
sep
An optional single character or byte to separate hex bytes.
bytes_per_sep
How many bytes between separators. Positive values count from the
right, negative values count from the left.
The return value is a bytes object. This function is also
available as "b2a_hex()".
rlecode_hqx
rlecode_hqx(data, /)
Binhex RLE-code binary data.
rledecode_hqx
rledecode_hqx(data, /)
Decode hexbin RLE-coded string.
unhexlify
unhexlify(hexstr, /)
Binary data of hexadecimal representation.
hexstr must contain an even number of hex digits (upper or lower case).