Zip File Extraction to Directory

  • Share this:

Code introduction


This function is used to unzip a zip file into a specified directory using the `zipfile` module.


Technology Stack : zipfile

Code Type : File operation

Code Difficulty : Intermediate


                
                    
def zipfile_extract(zip_path, extract_to):
    """
    解压zip文件到指定目录
    """
    import zipfile
    with zipfile.ZipFile(zip_path, 'r') as zip_ref:
        zip_ref.extractall(extract_to)                
              
Tags: