os method return zip file python code example
Example 1: how to unzip files using zipfile module python
import zipfile
with zipfile.ZipFile("file.zip","r") as zip_ref:
zip_ref.extractall("targetdir")
Example 2: python zip folder
import shutil
shutil.make_archive(output_filename, 'zip', dir_name)