x7zipfile is a thin 7-zip extract command wrapper for Python.
- The interface follows the style of zipfile.
- Archive operations are handled by executing external tool: 7z.
- Works with single file.
- Supports extract and list operations.
- Not supports compress operations.
- Supports archive formats that can be processed by the 7z command.
- Supports Unicode filenames.
- Supports password-protected archives.
- Python 3.7 or later
- 7-zip 16 or later
- Download
x7zipfile.py
from the github code page
- Place the
x7zipfile.py
file where you want. - Install 7-zip.
- Windows: https://www.newsgroupreviews.com/7-zip-installation.html
- Linux: run
sudo {apt,yum,dnf,snap} install p7zip-full
import x7zipfile
with x7zipfile.x7ZipFile('myarchive.7z') as zipfile:
for info in zipfile.infolist():
print(info.filename, info.file_size)
if info.filename == 'README':
zipfile.extract(info)
import importlib
namespace = 'x7zipfile'
loader = importlib.machinery.SourceFileLoader(namespace, '/path/to/x7zipfile.py')
x7zipfile = loader.load_module(namespace)
- Code: markokr/rarfile
- Test archives: miurahr/py7zr