I have a zip file with a folder in it, like this:
for filename in zip_file.namelist():
This prints the list of directories inside the
from zipfile import ZipFile with ZipFile('test.zip', 'r') as f: directories = [item for item in f.namelist() if item.endswith('/')] print directories
If you know that there is only one directory inside, just take the first item:
Hope that helps.