I cannot see a significant difference between the two following lines.
Yet the first parses, and the latter, does not.
In [5]: n=""" \\"Axis of Awesome\\" """
In [6]: n="""\\"Axis of Awesome\\""""
File "<ipython-input-6-d691e511a27b>", line 1
n="""\\"Axis of Awesome\\""""
^
SyntaxError: EOL while scanning string literal
Is this a Python bug/feature/oddity, or have I missing something fundamental?
The last four quote marks in
are parsed as
""", i.e. end of string, followed by", i.e. start of a new string literal. This new literal is never completed, though. Simple example:If you want to avoid this problem, then replace
"""withr'or escape the":