Advertisement
Peaser

compressor

Jul 4th, 2014
322
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Python 0.41 KB | None | 0 0
  1. import zlib
  2.  
  3. def compress(src,out,complvl=9):
  4.     with open(src, "rb") as in_file:
  5.         compressed = zlib.compress(in_file.read(), complvl)
  6.  
  7.     with open(out, "wb") as out_file:
  8.         out_file.write(compressed)
  9.  
  10. def decompress(src,out):
  11.     with open(src, "rb") as in_file:
  12.         compressed = zlib.decompress(in_file.read())
  13.  
  14.     with open(out, "wb") as out_file:
  15.         out_file.write(compressed)
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement