700字范文,内容丰富有趣,生活中的好帮手!
700字范文 > ZipFile 解压多个.zip压缩文件

ZipFile 解压多个.zip压缩文件

时间:2020-04-20 13:20:24

相关推荐

ZipFile 解压多个.zip压缩文件

点赞发Nature

关注中Science

用zipfile一次解压多个文件

import zipfile# go to the zip file folderzip_ls = os.chdir(zip_file_folder)extension = ".zip"for item in os.listdir(zip_ls): # loop through items in dirif item.endswith(extension): # check for ".zip" extensionfile_name = os.path.abspath(item) # get full path of fileszip_ref = zipfile.ZipFile(file_name) # create zipfile objectzip_ref.extractall(item[:-4]) # extract file to dirzip_ref.close() # close fileos.remove(file_name) # delete zipped file

————————

我目前奥尔堡大学做博士后(我的google scholar, 我的Github),关注能源转型过程中的环境、经济问题。

专注于分享利用python科研的技巧,欢迎一起交流、学习、合作。

关于我的博客内容、其他相关的研究问题,有问题可以下方👇评论、或私信我~

本内容不代表本网观点和政治立场,如有侵犯你的权益请联系我们处理。
网友评论
网友评论仅供其表达个人看法,并不表明网站立场。