該方法的原文地址: http://wangqige.com/the-solution-of-unzip-files-which-zip-under-windows/(鏈接已失效)
成都創(chuàng)新互聯(lián)公司成立于2013年,先為綠園等服務(wù)建站,綠園等地企業(yè),進(jìn)行企業(yè)商務(wù)咨詢(xún)服務(wù)。為綠園企業(yè)網(wǎng)站制作PC+手機(jī)+微官網(wǎng)三網(wǎng)同步一站式服務(wù)解決您的所有建站問(wèn)題。解決方法:保存如下Python代碼到文件unzip.py中
#!/usr/bin/env python # -*- coding: utf-8 -*- import os import sys import zipfile print "Processing File " + sys.argv[1] file=zipfile.ZipFile(sys.argv[1],"r"); for name in file.namelist(): utf8name=name.decode('gbk') print "Extracting " + utf8name pathname = os.path.dirname(utf8name) if not os.path.exists(pathname) and pathname!= "": os.makedirs(pathname) data = file.read(name) if not os.path.exists(utf8name): fo = open(utf8name, "w") fo.write(data) fo.close file.close()使用方法如下:
python unzip.py *.zip