Python gotcha of the day
Dan Sommers
dan at tombstonezero.net
Wed Mar 14 00:46:59 EDT 2018
On Wed, 14 Mar 2018 04:08:30 +0000, Steven D'Aprano wrote:
> Explain the difference between these two triple-quoted strings:
> But remove the spaces, and two of the quotation marks disappear:
>
> py> """\""""""
> '"'
That's (a) a triple quoted string containing a single escaped quote,
followed by (b) a quoted empty string. The two consecutive strings are
concatenated into a single string.
(Too many years of shell programming to miss this one!)
Dan
More information about the Python-list
mailing list