Created
July 20, 2017 06:52
-
-
Save linw1995/46af80a5c1b302868ab266c582d5c99f to your computer and use it in GitHub Desktop.
把多个zipfile整合成一个
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import zipfile | |
import glob | |
filenames = glob.glob('./*.zip') | |
with zipfile.ZipFile('output.zip', mode='w') as output: | |
for filename in filenames: | |
with zipfile.ZipFile(filename) as subZipFile: | |
for fn in subZipFile.namelist(): | |
data = subZipFile.read(fn) | |
output.writestr(fn, data) |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment