点赞发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科研的技巧,欢迎一起交流、学习、合作。
关于我的博客内容、其他相关的研究问题,有问题可以下方👇评论、或私信我~