.. _anomalous-backslash-in-string: anomalous-backslash-in-string / W1401 ===================================== **Message emitted:** ``Anomalous backslash in string: '%s'. String constant might be missing an r prefix.`` **Description:** *Used when a backslash is in a literal string but not as an escape.* **Problematic code:** .. literalinclude:: /data/messages/a/anomalous-backslash-in-string/bad.py :language: python **Correct code:** ``double_escape.py``: .. literalinclude:: /data/messages/a/anomalous-backslash-in-string/good/double_escape.py :language: python ``existing_escape_sequence.py``: .. literalinclude:: /data/messages/a/anomalous-backslash-in-string/good/existing_escape_sequence.py :language: python ``r_prefix.py``: .. literalinclude:: /data/messages/a/anomalous-backslash-in-string/good/r_prefix.py :language: python **Additional details:** ``\z`` is same as ``\\z`` because there's no escape sequence for ``z``. But it is not clear for the reader of the code. **Related links:** - `String and Bytes literals `_ - `Long form stackoverflow explanation `_ Created by the `string `__ checker.