Technically, any odd number of backslashes, as described in the documentation.
>>> r\'\\\'
File \"\", line 1
r\'\\\'
^
Syn
The reason for why r'\'
is syntactical incorrect is that although the string expression is raw the used quotes (single or double) always have to be escape since they would mark the end of the quote otherwise. So if you want to express a single quote inside single quoted string, there is no other way than using \'
. Same applies for double quotes.
But you could use:
'\\'