首页 > 其他分享 >2.14 解压压缩包 zipobj.extract() zipobj.extractall()

2.14 解压压缩包 zipobj.extract() zipobj.extractall()

时间:2022-10-28 22:14:42浏览次数:67  
标签:解压 zipobj zipfile extractall 2.14 extract 压缩包

解压压缩包   

zipobj.extract()       #解压压缩包的某个文件

import zipfile
with  zipfile.ZipFile('我的文件夹.zip','r')  as  zipobj:
    zipobj.extract('我的文件夹/demo18.py', 'new_dir')    #解压压缩包的某个文件到某个文件夹下
    print(zipobj.namelist())

zipobj.extractall()   解压压缩包全部文件

import zipfile
with  zipfile.ZipFile('我的文件夹.zip','r') as zipobj:
  zipobj.extractall()

  

 

标签:解压,zipobj,zipfile,extractall,2.14,extract,压缩包
From: https://www.cnblogs.com/988MQ/p/16837667.html

相关文章