1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 |
# -*- coding: utf-8 -*- ## Copyright 2019 Trevor van Hoof and Jan Pijpers. ## Licensed under the Apache License, Version 2.0 ## Downloaded from https://janpijpers.com or https://gumroad.com/janpijpers ## See the license file attached or on https://www.janpijpers.com/script-licenses/ ''' Name: zipFileExample Description: Simple zipfile example ''' import zipfile zipFilePath = r"C:\archive.zip" with zipfile.ZipFile(zipFilePath, "r") as zFile: ## Print all files in filenames. for f in zFile.infolist(): print f.filename ## Read a file print zFile.read("directory/file_name.extension") |