import zlib s = b'witch which has which witches wrist watch' print(len(s)) t = zlib.compress(s) print(" *******compress*******") print(t) print(" ") print(len(t)) print(" *******decompress*******") x=zlib.decompress(t) print(x) print(" ") print(len(x)) print(zlib.crc32(s))
输出
41 *******compress******* b'xx9c+xcf,IxceP(xcfxc8x04x92x19x89xc5PV9H4x15xc8+xca,.Q(Ox04xf2x00D?x0fx89' 37 *******decompress******* b'witch which has which witches wrist watch' 41 226805979