我使用的是 Python 2.5,无法升级 python 版本。
以下是我正在做的事情。
call(['cp', zipFileName, zipPath])
os.chdir(zipPath)
call(['unzip', zipFileName])
在上面的代码中,我遇到了错误。
解压缩:找不到或打开 gunzip gunzip.zip 或 gunzip.ZIP
我确实尝试了下面的代码。但仍然得到同样的错误。
for each in zip.namelist():
if not each.endswith('/'):
root, name = split(each)
directory = norm(join(path, root))
if not isdir(directory):
os.makedirs(directory)
file(join(directory, name), 'wb').write(zip.read(each))
如果您知道任何解决方法,请提出解决方法。
谢谢。