You can download this code by clicking the button below.
This code is now available for download.
This function creates a zipfile and adds files from a provided list to it.
Technology Stack : zipfile, os
Code Type : Python Function
Code Difficulty : Intermediate
def random_zipfile(filename, filelist):
import zipfile
import os
with zipfile.ZipFile(filename, 'w') as zipf:
for file in filelist:
zipf.write(file, os.path.basename(file))
return filename