See what is inside a ZIP without unpacking it. This AI-written Python prints e… · @chu_zheng74230 · TwKit
@chu_zheng74230
See what is inside a ZIP without unpacking it. This AI-written Python prints each file’s full path and uncompressed size. Enter the ZIP path when prompted: from zipfile import ZipFile with ZipFile(input("ZIP path: ")) as archive: for item in archive.infolist(): if not getattr(item, "is_dir")(): print(f"{item.file_size:>8} B {item.filename}") Actual output from a small constructed backup: 23 B 2025/notes.txt 22 B 2026/notes.txt 13 B café.txt The two notes.txt files stay distinguishable because their folders are included. Empty folders are omitted. The test extracted no files and left the ZIP unchanged; the numbers describe the files inside, not the ZIP’s compressed size.
曝光 13 · 评论 1 · 点赞 0 · 书签 0
查看原帖