+ 3
r keyword in regular expression
What purpose does “r” serve in starting the regular expression string with it?
3 Respuestas
+ 4
It declares the string as "raw", raw strings ignore the backslash (so no \n, \\, \t ect), these are also sometimes used for file paths
0
What does it mean to ignore it? I got the impression that the r made special characters not count, but in the contrary, they do count... What's going on? Can you give an example?
0
It means that: prefixing with an r merely indicates to the string that backslashes \ should be treated literally and not as escape characters for python