使用configparser读取文件
import configparser
config = configparser.ConfigParser()
# 文件内容
【RULES】
solution = issuetabpanels%3Aworklog-tabpanel
使用config.get("RULES", "solution") 读取文件包含会报错
InterpolationSyntaxError: '%' must be followed by '%' or '('xx
解决方案:
- 加入参数interpolation=None,即
import configparser
config = configparser.ConfigParser(interpolation=None)
- 修改文件,把一个%变成两个%%