Created
September 26, 2012 18:35
-
-
Save alsotang/3789718 to your computer and use it in GitHub Desktop.
测试zlib的压缩效率
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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