+ 1
Regular Expression
what is r when making a pattern like in r"spam"? like in the example: import re str = "My name is David. Hi David." pattern = r"David" newstr = re.sub(pattern, "Amy", str) print(newstr) it works the same if we set the value of pattern to "David" instead of r"David"
2 ответов
+ 4
string literal
a = "hello\nworld"
b = r"hello\nworld"
try print
u will see the difference
0
thanks