You can download this code by clicking the button below.
This code is now available for download.
This function creates a zip file containing two specified files.
Technology Stack : os, zipfile, shutil
Code Type : Function
Code Difficulty : Intermediate
def zipfiles(file1, file2):
import os
import zipfile
import shutil
# Create a new zip file
with zipfile.ZipFile('combined.zip', 'w') as zipf:
# Add file1 to the zip
zipf.write(file1)
# Add file2 to the zip
zipf.write(file2)
return 'combined.zip'