python代码中的问题[configparser.InterpolationSyntaxError:'%'后面必须是'%'或'(',找到的是'%'],使用python 3.7.3和appium一起使用

问题描述 投票:0回答:1

在终端日志下面供您参考

Traceback (most recent call last):
  File "src/Utilities_test/test_cases_csv.py", line 39, in <module>
    report_status = email_reporter(html_report_dir.split('/', 1)[-1])
  File "src/Utilities_support/report_email.py", line 27, in email_reporter for item in conf_data.items(conf): 
  File "/usr/local/Cellar/python/3.7.3/Frameworks/Python.framework/Versions/3.7/lib/python3.7/configparser.py", line 857, in items
    return [(option, value_getter(option)) for option in d.keys()]
  File "/usr/local/Cellar/python/3.7.3/Frameworks/Python.framework/Versions/3.7/lib/python3.7/configparser.py", line 857, in <listcomp>
    return [(option, value_getter(option)) for option in d.keys()]
  File "/usr/local/Cellar/python/3.7.3/Frameworks/Python.framework/Versions/3.7/lib/python3.7/configparser.py", line 854, in <lambda>
    section, option, d[option], d)
  File "/usr/local/Cellar/python/3.7.3/Frameworks/Python.framework/Versions/3.7/lib/python3.7/configparser.py", line 394, in before_get
    self._interpolate_some(parser, option, L, value, section, defaults, 1)
  File "/usr/local/Cellar/python/3.7.3/Frameworks/Python.framework/Versions/3.7/lib/python3.7/configparser.py", line 444, in _interpolate_some
    "found: %r" % (rest,))
configparser.InterpolationSyntaxError: '%' must be followed by '%' or '(', found: '%'
python appium python-3.7
1个回答
0
投票
[最有可能configparser正在读取字符串中的文字'%'符号。 '%'符号用于字符串插值(替代)。如果要使用文字“%”,可以使用另一个“%”对其进行转义。例如,在configparser读取的配置变量中,使用'100 %%'代表'100%'。
© www.soinside.com 2019 - 2024. All rights reserved.