我目前正在使用subprocess使用7zip解压选择或压缩文件。我不得不使用这种解包方法而不是zipfile模块,因为有时zipfile会损坏shapefile。我目前的方法是:
try:
for file in os.listdir(downloads):
print file
expression2 = sevenzip + " e " +downloads + '\\' + file + " -oC:\Users\Oulton"
print expression2
#os.system(r"C:\Users\Oulton\7z e C:\Users\Oulton\install.zip -oC:\Users\Oulton")
subprocess.call(expression2)
except:
time.sleep(3)
traceback.print_exc()
但这并不方便,因为:
7z e C:\Users\Oulton\install.zip -oC:\Users\Oulton" *.shp -r
3。在
^{pr2}$-i
和-x
可分别用于包含或排除特定文件以进行提取。在相关问题 更多 >
编程相关推荐