tar解壓指定文件
阿新 • • 發佈:2019-04-24
get mini orm enabled esc 獲取 defined pat xtra
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‘);
tar解壓指定文件