how do I read a ZIP file comment with python? 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.
To get a comment on an item, get it first using getinfo
, then take the comment
field:
import zipfile
archive = zipfile.ZipFile(r'D:\XXX\Desktop\MyZip.zip', 'r')
print(archive.getinfo("firstobj.1").comment)
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With