Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- # b_zlib_base64.py
- import zlib, base64
- s = 'blah blah blah blah blah blah blah blah blah blah blah blah'
- compressed = zlib.compress(s)
- print 'zlib (Non-Websafe):'
- print compressed
- print
- b64 = base64.encodestring(s)
- print 'Base64 Without zlib:'
- print b64
- zlib2base64= base64.encodestring(compressed)
- print 'Base64 With zlib:'
- print zlib2base64
- b64decoded = base64.decodestring(zlib2base64)
- decompressed = zlib.decompress(b64decoded)
- print 'String Normalized:'
- print decompressed
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement