I am looking to unzip a particular folder from a .zip in Python:
e.g. archive.zip contains the folders foo and bar, I want to
archive.zip
foo
bar
Check zipfile module.
For your case:
import zipfile archive = zipfile.ZipFile('archive.zip') for file in archive.namelist(): if file.startswith('foo/'): archive.extract(file, 'destination_path')