Pylint 检查器:不在字符串上调用格式函数

Pylint checker: Format function is not called on a string

代码在机翼等中运行良好。 Pylint 对我不断收到样式错误不太满意:

format function is not called on str (misplaced-format-function)

def print_daily_totals(rainfalls):
    '''t'''
    day = 0
    return_list = []
    for row in rainfalls:
        total = 0
        for i in row:
            total += i
        return_list.append(total)
    for value in return_list:
        print("Day {} total: {}").format(day, value)

rain = [ 
      [0, 7, 9],
      [4, 6, 2],
      [0, 0, 0],
      [10, 23, 5],
      [20, 0, 0]
]
print_daily_totals(rain)

你的括号放错了:

print("Day {} total: {}").format(day, value)

应该是

print("Day {} total: {}".format(day, value))

尽管我很难相信代码会像您建议的那样正常工作。 print returns None 并且没有方法 format.