How do I traverse the contents of a zip file in python without having to extract them?
If extracting is the only way, is it efficient if I create a unique temp folder and extract them there then traverse and remove the temp folder afterwards?
Use the namelist() method of the ZipFile class to get a list of all of the filenames in the archive without having to extract them. For example:
import zipfile myzip = zipfile.ZipFile('myzip.zip', 'r') filenames = myzip.namelist() # Do something with filenames infolist instead of namelist./.
zipfilemodule?