【摘要】 Python解压zip压缩包到指定文件路径,给大家介绍zipfile库的简单使用
ZIP文件格式是一种常见的归档和压缩标准。这个模块提供了创建、读取、写入、追加和列出ZIP文件的工具。
import zipfile
import os
“””
src_path:压缩包所在文件路径
target_path:压缩后文件存放路径
“””
src_path=r”\…
Python解压zip压缩包到指定文件路径,给大家介绍zipfile库的简单使用
ZIP文件格式是一种常见的归档和压缩标准。这个模块提供了创建、读取、写入、追加和列出ZIP文件的工具。
import zipfile
import os
"""
src_path:压缩包所在文件路径
target_path:压缩后文件存放路径
"""
src_path=r"\chrome\chromedriver_win32.zip"
target_path="\chrome\数据"
if(not os.path.isdir(target_path)): z = zipfile.ZipFile(src_path, 'r') z.extractall(path=target_path) z.close()
src_path:
target_path:
文章来源: blog.csdn.net,作者:北山啦,版权归原作者所有,如需转载,请联系作者。
原文链接:blog.csdn.net/qq_45176548/article/details/116327526
© 版权声明
文章版权归作者所有,未经允许请勿转载。
THE END