+ 2
Why there is no r before the "...." string?
Doesnt it mean that if it is not a raw string then its just a simple string with 4 dots?
1 ответ
+ 4
Special characters like \n or escaping characters are not intepreted in a raw string.
In a normal string, "\n" would be a character on its own and indicates a new line.
In a raw string however, r"\n" will be interpreted as a two character string, \ and n being separate characters with no special meaning.
That being said, even if a regex pattern is not a raw string, it can still be used if the characters have no special interpretation.