You can download this code by clicking the button below.
This code is now available for download.
Merge the contents of two files into a new zip file.
Technology Stack : Built-in libraries
Code Type : File operation
Code Difficulty : Beginner
def zipfiles(file1, file2):
with open(file1, 'rb') as f1, open(file2, 'rb') as f2:
zipped = f1.read() + f2.read()
with open('zipped_files.zip', 'wb') as zipped_file:
zipped_file.write(zipped)