Python: Standard Library - Data Compression

Directly supported by modules and common data compression format packing: zlib, gzip, bz2, zipfile, and tarfile.

import zlib
s = b’witch which has which witches wrist watch’
len(s)
41

t = zlib.compress(s)
len(t)
37

zlib.decompress(t)
b’witch which has which witches wrist watch’

zlib.crc32(s)
226805979

Guess you like

Origin blog.csdn.net/weixin_44523387/article/details/92164215