How to compress a text?
<p>I am trying to utilize Zlib for text compression.</p>

<p>For example I have a text <code>T='blah blah blah blah'</code> I need to compress it for this I am using <code>S=zlib.compress(T)</code> Now what I want is to get the ASCII form  of <code>S</code> so that I can decompress this <code>T</code> but in a different program.
Thanks, </p>

<p>EDIT: I guess I got a method to solve it here is the way:</p>

<pre><code>import zlib, base64
text = 'STACK OVERFLOW STACK OVERFLOW STACK OVERFLOW STACK OVERFLOW STACK OVERFLOW STACK OVERFLOW STACK OVERFLOW STACK OVERFLOW STACK OVERFLOW STACK OVERFLOW '
code =  base64.b64encode(zlib.compress(text,9))
print code
</code></pre>

<p>which gives :</p>

<pre><code>eNoLDnF09lbwD3MNcvPxD1cIHhxcAE9UKaU=
</code></pre>

<p>Now I can copy this code to a different program to get the original program back:</p>

<pre><code>import zlib, base64
s='eNoLDnF09lbwD3MNcvPxD1cIHhxcAE9UKaU='
data = zlib.decompress(base64.b64decode(s))
print data
</code></pre>

<p><strong>Please suggest if you are aware of any other compression method which would give better results</strong> while consistent to the same manner.</p>
