Python gotcha of the day

Steven D'Aprano steve+comp.lang.python at pearwood.info
Wed Mar 14 00:08:30 EDT 2018


Explain the difference between these two triple-quoted strings:

Here is a triple-quoted string containing spaces and a triple-quote:

py> """ \""" """
' """ '


But remove the spaces, and two of the quotation marks disappear:

py> """\""""""
'"'


If nobody gets the answer, I shall reveal all later.

(Hint: it is not a bug.)




-- 
Steve




More information about the Python-list mailing list