Welcome to seven_zip’s documentation!

The seven_zip module handles interaction from python with 7zip, p7zip. It only supports snooping in archives and unpacking.

you’ll need the 7zip binary in the path. get theese from here:

please consider a donation to Igor Wiktorowitsch Pawlow, paypal@7-zip.org

Get seven_zip from github: https://github.com/jojoo-/seven_zip/ (c) jonas osswald 2013, licensed as lgpl.

Demo!

Create a object like this:

>>> zipfile = seven_zip.SevenZip("file.zip")

then you can do fancy stuff like:

>>> zipfile.getnames()

to print all files in the archive. or extract it:

>>> zipfile.extractall("~/")

or more advanced: extract only jpg’s bigger than 1MB to a special folder:

>>> for member in zipfile.searchmember("*.jpg"):
>>>    if member.size > (1024**2):
>>>        member.extract("/tmp/bigpictures")

Indices and tables