You can download this code by clicking the button below.
This code is now available for download.
This function creates a zip file and adds a specified file to the zip file.
Technology Stack : zipfile
Code Type : File operation
Code Difficulty : Intermediate
def zipfile(arg1, arg2):
import zipfile
with zipfile.ZipFile(arg1, 'w') as zipf:
zipf.write(arg2, arcname='example.txt')
return zipfile.ZipFile(arg1)