You can download this code by clicking the button below.
This code is now available for download.
This function zips two files into a single ZIP file.
Technology Stack : os, zipfile
Code Type : File operation
Code Difficulty : Intermediate
def zip_file(file1, file2, output):
import os
import zipfile
with zipfile.ZipFile(output, 'w') as z:
z.write(file1)
z.write(file2)
return f"Files {file1} and {file2} have been zipped into {output}"