7.15 zlib -- Compression compatible with gzip
For applications that require data compression, the functions in this module allow compression and decompression, using the zlib library. The zlib library has its own home page at http://www.gzip.org/zlib/. There are known incompatibilities between the Python module and versions of the zlib library earlier than 1.1.3; 1.1.3 has a security vulnerability, so we recommend using 1.1.4 or later.
compress( string[, level])
Compresses the data in string, returning a string contained compressed data. level is an integer from 1 to 9 controlling the level of compression; 1 is fastest and produces the least compression, 9 is slowest and produces the most. The default value is 6. Raises the error exception if any error occurs.
Es geht um eine Liste mit 2,5 Millionen Einträgen (22 MB) und die würde ich gerne mit compress komprimieren.
Leider verlangt compress einen String ... wie kann ich das Ganze casten? Und dann nach dem dekomprimieren wieder zurückcasten?
Ich könnts erst in einen String umwandeln ... und dann wieder mit eval einlesen, aber das dauert ewig. Da lohnt sich die Kompression dann gar nicht.
Gibts da ne Lösung um das ganze zur Laufzeit zu komprimieren?
[/quote]