r"\"" ??? (was A simple single line, triple-quoted comment)

Chris Angelico rosuav at gmail.com
Fri Apr 3 16:40:10 CEST 2015

On Fri, Apr 3, 2015 at 11:52 PM, Rustom Mody <rustompmody at gmail.com> wrote:
> Speaking about silliness of definitions, I was knocked out in class by this today:
>>>> r"\""
> '\\"'
> Seeing the docs
> https://docs.python.org/3.4/reference/lexical_analysis.html#string-and-bytes-literals
> it talks of this explicitly
> But I still find it strange -- I would have expected this kind of error behavior:
>>>> "A string" "another incomplete
> SyntaxError: EOL while scanning string literal

I'm sorry, I'm not understanding your confusion here. A raw string
literal allows escaped quote characters - is that the problem?


More information about the Python-list mailing list