Skip to content

Instantly share code, notes, and snippets.

@stevenswafford
Created June 5, 2015 03:35
  • Star 1 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
Star You must be signed in to star a gist
Save stevenswafford/4e78f6bee40ab31b35c8 to your computer and use it in GitHub Desktop.
Demonstrates how to use zipfile to list the files contained in a zip archive.
import zipfile
myZipFile = zipfile.ZipFile( "test.zip", "r" )
# List all files contained within the zip file
for fileName in myZipFile.namelist():
print fileName
print
# List file information
for info in myZipFile.infolist():
print info.filename, info.date_time, info.file_size
raw_input( '\n\nPress Enter to exit...' )
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment