Simple question - end a raw string with a single backslash ?
Serhiy Storchaka
storchaka at gmail.com
Thu Oct 15 15:37:02 EDT 2020
15.10.20 22:16, Roland Müller via Python-list пише:
> I used the triple single quotes as delimiter:
>
>>>> s = r'''a single quote ', a double quote "'''
>>>> s
>
> 'a single quote \', a double quote "'
It does not help if the string contains both kinds of triple quotes
You have to use triple quotes (''', """) for docstrings.
or contains one kind of triple quote and ends with a single quote of
other kind.
a triple single quote ''', a single double quote "
Of course there are workarounds, but the fact that changing the current
rules will break existing code.
More information about the Python-list
mailing list