Strings: double versus single quotes
Tim Chase
python.list at tim.thechases.com
Sat May 23 19:00:18 EDT 2020
On 2020-05-23 14:46, Dennis Lee Bieber wrote:
> On Sat, 23 May 2020 11:03:09 -0500, Tim Chase
> >But when a string contains both, it biases towards single quotes:
> >
> > >>> "You said \"No it doesn't\""
> > 'You said "No it doesn\'t"'
>
> This is where using triple quotes (or triple apostrophes)
> around the entire thing simplifies it all... (except for a need to
> separate the four ending quotes)
Unless you're pathological. ;-)
>>> """I said "This contain every type of \"""Python\""" '''triple-quoted''' string, doesn't it?\""""
'I said "This contains every type of """Python""" \'\'\'triple-quoted\'\'\' string, doesn\'t it."'
And-you-can-quote-me-on-that'ly yers,
-tkc
More information about the Python-list
mailing list