You can download this code by clicking the button below.
This code is now available for download.
This function zips two files into a single zip file.
Technology Stack : os, zipfile
Code Type : File processing
Code Difficulty : Intermediate
def zip_file(file1, file2, output):
import os
import zipfile
# 创建zip文件
with zipfile.ZipFile(output, 'w') as zipf:
# 添加文件1
zipf.write(file1)
# 添加文件2
zipf.write(file2)
return output