[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Simple question - end a raw string with a single backslash ?

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.