binascii — 在二进制和 ASCII 之间转换


The binascii module contains a number of methods to convert between binary and various ASCII-encoded binary representations. Normally, you will not use these functions directly but use wrapper modules like base64 instead. The binascii module contains low-level functions written in C for greater speed that are used by the higher-level modules.

注意

a2b_* functions accept Unicode strings containing only ASCII characters. Other functions only accept 像字节对象 (譬如 bytes , bytearray 及其它支持缓冲协议的对象)。

3.3 版改变: 现在仅接受 ASCII 的 Unicode 字符串通过 a2b_* 函数。