zip.py 319 B

123456789101112
  1. import zipfile
  2. import os.path
  3. def unzip( archive_path, result_dir ):
  4. z = zipfile.ZipFile( archive_path, 'r', zipfile.ZIP_DEFLATED )
  5. for f in z.infolist():
  6. result = open( os.path.join( result_dir, f.filename ), 'wb' )
  7. result.write( z.read( f.filename ) )
  8. result.close()
  9. z.close()
粤ICP备19079148号