Compress Two Files into a Zip Archive

  • Share this:

Code introduction


Compresses two files into a zip archive.


Technology Stack : shutil

Code Type : File operation

Code Difficulty : Intermediate


                
                    
def zip_file(file1, file2, output):
    import shutil
    shutil.make_archive(output, 'zip', file1, file2)
    return output + '.zip'                
              
Tags: