Consider the following python code using the regex library re
import re
re.compile(rf"{''.join(['{c}\s*' for c in 'qqqq'])}")
I have run it in two different REPLs:
https://www.pythonmorsels.com/repl/
https://www.online-python.com/#google_vignette
The first of which gives no error, and the second give the following error:
File "main.py", line 2
re.compile(rf"{''.join(['{c}\s*' for c in 'qqqq'])}")
^
SyntaxError: f-string expression part cannot include a backslash
I have found a similar discrepancy in behaviour between my machine and my friends machine, both running Ubuntu. I’d like to understand why I get an error sometimes and not others. Is this due to a different version of python? How can I proceed to narrow down exactly where the difference is? Thanks