How can i list only the folders from a zip archive? This will list every folfder and file from the archive:
import zipfile
file = zipfile.ZipFile("samples/sample.zip", "r")
for name in file.namelist():
print name
Thanks.
One way might be to do:
>>> [x for x in file.namelist() if x.endswith('/')]
<<< ['folder/', 'folder2/']