Create ZIP File from Input Path

  • Share this:

Code introduction


This function compresses the file at the specified input path into a zip format and saves it to the specified output path.


Technology Stack : zipfile

Code Type : File compression and decompression

Code Difficulty : Intermediate


                
                    
def zipfile_create(input_path, output_path):
    import zipfile
    with zipfile.ZipFile(output_path, 'w') as zipf:
        zipf.write(input_path, arcname=input_path)
    return output_path                
              
Tags: