Create ZIP File from Input

  • Share this:

Code introduction


This function takes an input file path and an output file path, packs the input file into a ZIP format, and returns the path of the packed file.


Technology Stack : zipfile

Code Type : Function

Code Difficulty : Intermediate


                
                    
def zipfile_create(input_file, output_file):
    with zipfile.ZipFile(output_file, 'w') as zipf:
        zipf.write(input_file, arcname=input_file)
    return output_file                
              
Tags: