Skip to content

Instantly share code, notes, and snippets.

@alsotang
Created September 26, 2012 18:35
Show Gist options
  • Save alsotang/3789718 to your computer and use it in GitHub Desktop.
Save alsotang/3789718 to your computer and use it in GitHub Desktop.
测试zlib的压缩效率
import zlib
import base64
filename = '1.jpg'
with open(filename, 'rb') as f:
data = f.read()
print len(data)
bdata = base64.encodestring(data)
print len(bdata)
zdata = zlib.compress(bdata)
print len(zdata)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment