Using r for strings and re library | Sololearn: Learn to code for FREE!
New course! Every coder should learn Generative AI!
Try a free lesson
0

Using r for strings and re library

I was just wondering if it’s worth using r on all strings so they all become raw and therefore if you need to use the re library the r is already. Is this good practice?

27th Oct 2018, 8:07 AM
Thomas Hemming
1 Answer
0
Because strings in regular expression sometimes uses \, there is a small risk that they would escape a newline or similar. With raw strings that would not happen.
10th Jun 2019, 9:20 PM
Seb TheS
Seb TheS - avatar