Skip to content

Instantly share code, notes, and snippets.

@linw1995
Created July 20, 2017 06:52
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save linw1995/46af80a5c1b302868ab266c582d5c99f to your computer and use it in GitHub Desktop.
Save linw1995/46af80a5c1b302868ab266c582d5c99f to your computer and use it in GitHub Desktop.
把多个zipfile整合成一个
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