"Anomalous backslash in string: '%s'. String constant might be missing an r prefix."
Used when a backslash is in a literal string but not as an escape.
In the following examle the string that is assigned to
bad has a bad
backslash sequence (
\s). The string
good is marked as a raw string
r prefix). In
also_good the backslash before
s is escaped.
def example(): bad = "String with \some backslash" good = r"String with \some backslash" also_good = "String with \\some backslash"
2:12: W1401: Anomalous backslash in string: '\s'. String constant might be missing an r prefix.
Some of the supported backslash sequences are
\n for newline,
\t for a
\\ for a backslash. See the python docs. for the