classification
Title: raw strings SyntaxError
Type: behavior Stage: resolved
Components: Versions: Python 3.9, Python 3.8
process
Status: closed Resolution: not a bug
Dependencies: Superseder:
Assigned To: Nosy List: anmikf, eric.smith, paul.moore, steve.dower, tim.golden, zach.ware
Priority: normal Keywords:

Created on 2020-12-09 03:18 by anmikf, last changed 2020-12-09 04:16 by eric.smith. This issue is now closed.

Messages (2)
msg382785 - (view) Author: 安迷 (anmikf) Date: 2020-12-09 03:18
[test@test ~]# python3 -c 'print(r"\n")'
\n
[test@test ~]# python3 -c 'print(r"n\")'
  File "<string>", line 1
    print(r"n\")
               ^
SyntaxError: EOL while scanning string literal
msg382786 - (view) Author: Eric V. Smith (eric.smith) * (Python committer) Date: 2020-12-09 04:16
This is a FAQ: https://docs.python.org/3/faq/design.html#why-can-t-raw-strings-r-strings-end-with-a-backslash

Raw strings can't end with an odd number of backslashes.
History
Date User Action Args
2020-12-09 04:16:03eric.smithsetstatus: open -> closed

components: - Windows

nosy: + eric.smith
messages: + msg382786
resolution: not a bug
stage: resolved
2020-12-09 03:18:11anmikfcreate