使用zipfile模塊,我創建了一個腳本來提取我的歸檔文件,但是這個方法會破壞除txt文件之外的所有內容。在def unzip(zip):
filelist = []
dumpfold = r'M:\SVN_EReportingZones\eReportingZones\data\input\26012012'
storage = r'M:\SVN_EReportingZones\eReportingZones\data\input\26012012__download_dump'
file = storage + '\\' + zip
unpack = dumpfold + '\\' + str(zip)
print file
try:
time.sleep(1)
country = str(zip[:2])
countrydir = dumpfold + '\\' + country
folderthere = 0
if exists(countrydir):
folderthere = 1
if folderthere == 0:
os.makedirs(countrydir)
zfile = zipfile.ZipFile(file, 'r')
## print zf.namelist()
time.sleep(1)
shapepresent = 0
這里我有一個問題-通過讀寫壓縮數據,zipfile命令似乎使它無法被相關程序使用-我試圖解壓shapefile以在ArcGIS中使用。。。在
^{pr2}$
可以用系統命令調用WinRar并讓它幫我解包嗎?干杯,亞歷克斯
編輯
使用wb方法后,它適用于我的大多數文件,但有些文件仍在損壞。當我使用winRar手動解壓有問題的文件時,它們會正確加載,并且文件大小也會更大。在
有人能告訴我加載winRar的方向嗎?在