Python gotcha of the day

Bill WhoKnows at newsguy.com
Wed Mar 14 01:16:20 EDT 2018


Dan Sommers wrote:
> 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.

The last part stumped me!  :  )


> 
> (Too many years of shell programming to miss this one!)
> 
> Dan
> 




More information about the Python-list mailing list