You can download this code by clicking the button below.
This code is now available for download.
Combine the contents of two files into a new ZIP file.
Technology Stack : Built-in libraries
Code Type : File processing
Code Difficulty : Intermediate
def zip_file(file1, file2):
with open(file1, 'rb') as f1, open(file2, 'rb') as f2:
z = zip(f1, f2)
with open('zipped_files.zip', 'wb') as f3:
for i in z:
f3.write(i)