tar解压指定文件

import tarfile
import sys
#tar = tarfile.open('/opt/platform-omp/omp.tar.gz','r')
tar = tarfile.open(r'C:\Users\Administrator\Desktop\omp.tar.gz','r')

path=''
# 获取包内的所有文件列表
for i in tar.getnames():
if 'kara_create.sql' in i:
path=i
break
print (path)
if path:
member=tar.getmember(path)
res=tar.extract(member, path=r"C:\Users\Administrator\Desktop")
print (res)
else:
print ('未找到文件')
sys.exit(1)

# insert into config_param (`key`, `value`, `defined_value`, `description`, `need_reboot`) values ('captcha.enabled', 'true', 'true', '{"en_US":"Whether to open the verifying code","zh_CN":"是否开启验证码"}', 'false');
上一篇:并行程序设计之Openmp


下一篇:OpenMP学习摘录