相关疑难解决方法(0)

PyLint消息:logging-format-interpolation

对于以下代码:

logger.debug('message: {}'.format('test'))
Run Code Online (Sandbox Code Playgroud)

pylint 产生以下警告:

记录格式插值(W1202):

在日志记录函数中使用%格式并将%参数作为参数传递当日志语句的调用形式为"logging.(format_string.format(format_args ...))"时使用.此类调用应使用%格式,但通过将参数作为参数传递,将插值留给日志记录功能.

我知道我可以关掉这个警告,但我喜欢理解它.我假设使用format()是打印输出语句的首选方法pylint.为什么记录器语句不适用?

python pylint python-3.x

128
推荐指数
4
解决办法
3万
查看次数

标签 统计

pylint ×1

python ×1

python-3.x ×1