You can download this code by clicking the button below.
This code is now available for download.
This function accepts a path to a zip file and a target extraction directory, and extracts the contents of the zip file to the specified directory.
Technology Stack : zipfile
Code Type : File operation
Code Difficulty : Intermediate
def zipfile_extract(file_path, extract_to_dir):
"""
解压zip文件到指定目录
"""
import zipfile
with zipfile.ZipFile(file_path, 'r') as zip_ref:
zip_ref.extractall(extract_to_dir)