You can download this code by clicking the button below.
This code is now available for download.
Compress two files into a single zip file and return the path of the generated zip file.
Technology Stack : os, zipfile
Code Type : Function
Code Difficulty : Intermediate
def zip_file(file1, file2, output_file):
import os
import zipfile
with zipfile.ZipFile(output_file, 'w') as zipf:
zipf.write(file1, os.path.basename(file1))
zipf.write(file2, os.path.basename(file2))
return output_file