import py7zr,os
path=r'C:\Users\Lenovo\Desktop\2' #解压桌面上”2“文件夹内的7z格式压缩包
os.chdir(path)
for i in os.listdir(path):
archive = py7zr.SevenZipFile(i)
try:
archive.extractall()
archive.close()
os.remove(i)
except:
break
import py7zr,os
path=r'C:\Users\Lenovo\Desktop\2' #解压桌面上”2“文件夹内的7z格式压缩包
os.chdir(path)
for i in os.listdir(path):
archive = py7zr.SevenZipFile(i)
try:
archive.extractall()
archive.close()
os.remove(i)
except:
break