def zip_folder_content(folder, filename):
 with zipfile.ZipFile(filename, 'w', zipfile.ZIP_DEFLATED) as dest:
  for (root, dirs, files) in os.walk(folder):
   relative_dir = os.path.relpath(root, folder)
   for file_ in files:
    dest.write(os.path.join(root, file_), arcname=os.path.join(relative_dir, file_))

def zip_folder_content ( folder , filename ) : with zipfile . ZipFile ( filename , 'w' , zipfile . ZIP_DEFLATED ) as dest : for ( root , dirs , files ) in os . walk ( folder ) : relative_dir = os . path . relpath ( root , folder ) for file_ in files : dest . write ( os . path . join ( root , file_ ) , arcname = os . path . join ( relative_dir , file_ ) )
compress the _content_ of a folder .