mixed-format-string / E1302ΒΆ

Message emitted:

Mixing named and unnamed conversion specifiers in format string


Used when a format string contains both named (e.g. '%(foo)d') and unnamed (e.g. '%d') conversion specifiers. This is also used when a named conversion specifier contains * for the minimum field width and/or precision.

Problematic code:

print("x=%(x)d, y=%d" % (0, 1))  # [mixed-format-string]

Correct code:


print("x=%(x)d, y=%(y)d" % {"x": 0, "y": 1})


print("x=%d, y=%d" % (0, 1))

Created by the string checker.