def zipGetComSize(content):
content = content.split()
if len(content) > 1:
try:
zipFile = zipfile.ZipFile(content[1])
infoOfFile = zipFile.getinfo(content[0])
zipFile.close()
return [str(infoOfFile.compress_size) + ' KB']
except FileNotFoundError:
return ['1f401268File %r Not Found' %(content[1])]
except zipfile.BadZipFile:
return ['1f401268File %r is not a zip file' %(content[1])]
except KeyError:
return ['1f401268There no item named %r in the archive' %(content[0])]
except:
return ['Something went wrong when trying to handel file %r' %(content[1])]
else:
return ['zip getfilesize item file_zip']
评论列表
文章目录