格式字符串 python 的参数不足
Not enough arguments for format string python
在 codacy 上,它检测到我没有足够的格式字符串参数的问题。请帮忙
代码:
self.notify.error("An item we don't have: track %s level %s was selected." % [track, level])
传递元组,而不是列表
self.notify.error("An item we don't have: track %s level %s was selected." % (track, level))
我就是这样修复的
"An item we don't have: track {} level {} was selected.".format(track, level)
在 codacy 上,它检测到我没有足够的格式字符串参数的问题。请帮忙
代码:
self.notify.error("An item we don't have: track %s level %s was selected." % [track, level])
传递元组,而不是列表
self.notify.error("An item we don't have: track %s level %s was selected." % (track, level))
我就是这样修复的
"An item we don't have: track {} level {} was selected.".format(track, level)