need help with decompress

Andrew M. Kuchling akuchlin at
Thu Jun 3 17:03:50 EDT 1999

Philip C. writes:
>using the zlib module o found out how to compress springs but I having
>trouble with decompressing them.

Decompressing is just as simple as compressing:

amarok akuchlin>python
Python 1.5.2 (#80, May 25 1999, 18:06:07)  [GCC 2.8.1] on sunos5
Copyright 1991-1995 Stichting Mathematisch Centrum, Amsterdam
i>>> import zlib
>>> c = zlib.compress("""So, if this were indeed my Final Hour, ... """)
>>> c   
>>> print zlib.decompress(c)
So, if this were indeed my Final Hour, these would be my words to you.
   I would not claim to pass on any secret of life, for there is none, or
   any wisdom except the passionate plea of caring ... Try to feel, in
   your heart's core, the reality of others. This is the most painful
   thing in the world, probably, and the most necessary. In times of
   personal adversity, know that you are not alone. Know that although in
   the eternal scheme of things you are small, you are also unique and
   irreplaceable, as are all of your fellow humans everywhere in the 
   world. Know that your commitment is above all to life itself.


>is there any way to scramble string sort of encrypt them

    Python includes the "rotor" module, which does some simple but not
necessarily secure encryption.  mxCrypto
( contains more
industrial-strength encryption for Python.

A.M. Kuchling

More information about the Python-list mailing list