compress string of data
Josiah Carlson
jcarlson at nospam.uci.edu
Mon Jan 26 10:21:17 EST 2004
Piet van Oostrum wrote:
>>>>>>Gerrit Holl <gerrit at nl.linux.org> (GH) wrote:
>
>
>>>How i could compress string of data?.
>>>
>>>>>import zlib
>>>>>zlib.compress("Hello, world")
>
> GH> 'x\x9c\xf3H\xcd\xc9\xc9\xd7Q(\xcf/\xcaI\x01\x00\x1b\xd4\x04i'
>
> GH> http://www.python.org/doc/current/lib/module-zlib.html
>
> Waw, that compresses it from 12 bytes to 20 bytes :=)
There is no such thing as universal compression - some compressions
result in expansion.
- Josiah
More information about the Python-list
mailing list