You have to use namelist()
and extract()
. Sample considering directories
import zipfile
import os.path
import os
zfile = zipfile.ZipFile("test.zip")
for name in zfile.namelist():
(dirname, filename) = os.path.split(name)
print "Decompressing " + filename + " on " + dirname
if not os.path.exists(dirname):
os.makedirs(dirname)
zfile.extract(name, dirname)
与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…