how to zip each folder of a directory python code example Example: zip a directory in python shutil.make_archive(output_filename, 'zip', dir_name)