Unzip ZIP Files to a Directory

  • Share this:

Code introduction


This function is used to unzip a ZIP formatted archive to a specified directory.


Technology Stack : zipfile

Code Type : File operation

Code Difficulty : Intermediate


                
                    
def zipfile_extract(file_path, extract_to):
    import zipfile

    with zipfile.ZipFile(file_path, 'r') as zip_ref:
        zip_ref.extractall(extract_to)                
              
Tags: