Python Language Extracting zip file contents to a directory


Example

Extract all file contents of a zip file

import zipfile
with zipfile.ZipFile('zipfile.zip','r') as zfile:
    zfile.extractall('path')

If you want extract single files use extract method, it takes name list and path as input parameter

import zipfile
f=open('zipfile.zip','rb')
zfile=zipfile.ZipFile(f)
for cont in zfile.namelist():
    zfile.extract(cont,path)