python uzip
import zipfile
import os
def un_zip(file_name):
"""unzip zip file"""
zip_file = zipfile.ZipFile(file_name)
if os.path.isdir(file_name + "_files"):
pass
else:
"""os.mkdir(file_name + "_files")"""
for names in zip_file.namelist():
if names=="word/media/image1.png":
getFileData=zip_file.read(names)
"""(lambda f, d: (f.write(d), f.close()))(open(r'C:/Users/weiyj4/Desktop/hehe/xxxxxxxxxxxx.png', 'wb'), getFileData)"""
fileInfo=os.path.split(file_name)
parentPath=fileInfo[0]
fileImg=fileInfo[1]
print parentPath+fileImg+".png"
(lambda f, d: (f.write(d), f.close()))(open(parentPath+"/"+fileImg+".png", 'wb'), getFileData)
"""zip_file.extract(names,parentPath+"/"+fileImg+".png") """
zip_file.close()