Python raw strings and trailing backslash [duplicate]

It’s a FAQ.

And in response to “you really want your string to end with a backslash. There’s no way to do that in a ‘raw’ string.”: the FAQ shows how to workaround it.

>>> r'ab\c' '\\' == 'ab\\c\\'
True
>>>

Leave a Comment