Yep, totally agree with @apksha.shukla and to add to that, I mainly rely on python r string
in regex work. Regex is already tricky, escaping every backslash would be a nightmare.
So instead of this:
pattern = "\\d+\\.\\d+"
I use:
pattern = r"\d+\.\d+"
Cleaner and easier to read.
Also, quick note: ur""
was from Python 2. In Python 3, just use r""
, everything is Unicode by default now.