On Sat, 23 May 2020 14:46:04 -0400 Dennis Lee Bieber <wlfr...@ix.netcom.com> wrote:
> On Sat, 23 May 2020 11:03:09 -0500, Tim Chase > <python.l...@tim.thechases.com> declaimed the following: > > > > > >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) Exactly, I also would opt for triple quotes in this case. > > >>> """You said "No it doesn't" """ > 'You said "No it doesn\'t" ' > >>> '''You said "No it doesn't"''' > 'You said "No it doesn\'t"' > >>> > > NO \ escapes needed on the input strings. > > >>> print("""You said "No it doesn't" """) > You said "No it doesn't" > >>> print('''You said "No it doesn't"''') > You said "No it doesn't" > >>> > > -- Manfred -- https://mail.python.org/mailman/listinfo/python-list