You can download this code by clicking the button below.
This code is now available for download.
This function zips all files in the given file list into a single zip file and saves it to the specified output path.
Technology Stack : os, zipfile
Code Type : File compression
Code Difficulty : Intermediate
def zipfiles(file_list, output_zip):
import os
import zipfile
with zipfile.ZipFile(output_zip, 'w') as zipf:
for file in file_list:
zipf.write(file, os.path.basename(file))
return True