You can download this code by clicking the button below.
This code is now available for download.
This function merges files from two lists into a single ZIP file. Files from the first list are used as the source files, and their corresponding names from the second list will be used as the names in the compressed file.
Technology Stack : zipfile
Code Type : File processing
Code Difficulty : Intermediate
def zipfiles(file_list1, file_list2):
zip_file = zipfile.ZipFile('combined.zip', 'w')
for file1, file2 in zip(file_list1, file_list2):
zip_file.write(file1, arcname=file2)
zip_file.close()