首页 > 编程语言 > 详细

RawConfigParser 与 ConfigParser ——Python的配件文件读取模块

时间:2019-03-21 13:45:17      阅读:1379      评论:0      收藏:0      [点我收藏+]

一般情况都是使用ConfigParser这个方法但是当我们配置中有%(filename)s这种格式的配置的时候可能会出现以下问题:

 

configparser.InterpolationMissingOptionError: Bad value substitution: option ‘output_fmt‘ in section ‘output‘ contains an interpolation key ‘asctime‘ which is not a valid option name.

Raw value: ‘"%(asctime)s-%(levelname)s-%(filename)s-%(name)s-日志信息:%(message)s"‘

 

解决办法就是:

将configparser方法换成了RawConfigParser方法上面的问题就pass掉了。

RawConfigParser 与 ConfigParser ——Python的配件文件读取模块

原文:https://www.cnblogs.com/rightlight/p/10571083.html

(0)
(0)
   
举报
评论 一句话评论(0
关于我们 - 联系我们 - 留言反馈 - 联系我们:wmxa8@hotmail.com
© 2014 bubuko.com 版权所有
打开技术之扣,分享程序人生!