How can one copy the internal state of zlib compressor object in Python
问题 I have to compress a long list of strings. I have to compress them individually. Each string is less than 1000 chars long. However many of these strings have a common prefix. Therefore I was wondering if I could amortize the compression cost, by compressing the common prefix first and then storing the state of the compressor and feed it the suffix of the strings. If you have any suggestions about how to accomplish this in Python that would be great. Although I mention zlib in the title any