[英]Python, reading a zip file comment
how do I read a ZIP file comment with python? 如何使用python读取ZIP文件注释? I tried using 我试过用
import zipfile
archive = zipfile.ZipFile('D:\XXX\Desktop\MyZip.zip', 'r')
comment = archive.comment("firstobj.1")
but it does not work... Any help would be appreciated :) thanks 但它不起作用...任何帮助将不胜感激:)谢谢
archive.comment()
takes no argument and returns the comment of the archive itself. archive.comment()
接受任何参数并返回归档本身的注释。
To get a comment on an item, get it first using getinfo
, then take the comment
field: 要获得对项目的评论,请先使用getinfo
获取,然后获取comment
字段:
import zipfile
archive = zipfile.ZipFile(r'D:\XXX\Desktop\MyZip.zip', 'r')
print(archive.getinfo("firstobj.1").comment)
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.