os.walk interface for nested zipfiles
Project description
zipwalk
A very simple walker that recursively walks through nested zipfiles
About
This project was created because I needed a way to iterate over nested zipfiles without unzipping them.
Install
pip install zipwalk
Usage
It has a similar interface to os.walk:
from zipwalk import zipwalk
for root, zips, files in zipwalk('tests/1.zip'):
print('root:', root.filename)
print('zips:', zips)
print('files:', files)
# output:
# root: tests/1.zip
# zips: {'2.zip'}
# files: {'1c.txt', 'dir/d1.txt', '1b.txt', '1a.txt'}
# root: 2.zip
# zips: set()
# files: {'2c.txt', '2b.txt', '2a.txt'}
root is an ZipFile instance opened on read mode, r. All zip files are
opened using with context manager and will be closed once the generator is
exhausted.
You can use the zip walker like the following:
from pathlib import Path
from zipfile import ZipFile
from zipwalk import zipwalk
zipwalk(ZipFile('tests/1.zip'))
zipwalk(Path('tests/1.zip'))
zipwalk('tests/1.zip')
Project details
Release history Release notifications | RSS feed
Download files
Download the file for your platform. If you're not sure which to choose, learn more about installing packages.
Source Distribution
Built Distribution
Filter files by name, interpreter, ABI, and platform.
If you're not sure about the file name format, learn more about wheel file names.
Copy a direct link to the current filters
File details
Details for the file zipwalk-0.1.4.tar.gz.
File metadata
- Download URL: zipwalk-0.1.4.tar.gz
- Upload date:
- Size: 1.6 kB
- Tags: Source
- Uploaded using Trusted Publishing? Yes
- Uploaded via: twine/4.0.2 CPython/3.11.5
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
e4df4b41d9502c9b39e56c4d815561a79ce304a9c707abb0a8fb4f8389cda7d4
|
|
| MD5 |
f1662cf5012e4316b8d08a678d21ee01
|
|
| BLAKE2b-256 |
d87b63683a2300417ce70972aaa1338b97e509263423e5a6b87a3171aff2f323
|
File details
Details for the file zipwalk-0.1.4-py3-none-any.whl.
File metadata
- Download URL: zipwalk-0.1.4-py3-none-any.whl
- Upload date:
- Size: 1.9 kB
- Tags: Python 3
- Uploaded using Trusted Publishing? Yes
- Uploaded via: twine/4.0.2 CPython/3.11.5
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
0317ae333e304e9fc2a7caf50e2e5198aaca8a022baa17d87335cb207133262c
|
|
| MD5 |
b400a03c2bd014dc16f0fb624763bc41
|
|
| BLAKE2b-256 |
0e7fe160da735e5d3106ac15502e5a0a73384b0109576f61185ce170f153ea9c
|