Strings: double versus single quotes

Souvik Dutta souvik.viksou at gmail.com
Sat May 23 22:56:17 EDT 2020


This seems to be a life long debate...

On Sun, 24 May, 2020, 5:25 am Tim Chase, <python.list at tim.thechases.com>
wrote:

> 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
>
>
>
> --
> https://mail.python.org/mailman/listinfo/python-list
>


More information about the Python-list mailing list