On 9/10/22 13:20, Stefan Ram wrote:
writes:
'Version: \d+.\d+.\d+.*'
All unrecognized escape sequences are left in the string
unchanged, i.e., the backslash is left in the result.
This behavior is useful when debugging: if an escape
sequence is mistyped, the resulting output is m
I don't know what flake8 is complaining about, but I think you want a
literal "." character in front of the two "\d" escapes. So "." should
be replaced by "\." in two places. In addition to using a raw string,
that is.
If you may need to detect versions larger than 9 in any position, you
wo
On Sat, Sep 10, 2022 at 06:46:33PM +, c.bu...@posteo.jp wrote:
>
> But running this with Python 3.9.2 makes no problem. Python doesn't
> give me a `SyntaxWarning` or anything else. Python doesn't give me an
> error or warning. Only `flymake8` gives me this error.
Well, it's not a syntax error
On 2022-09-10 19:46, c.bu...@posteo.jp wrote:
Hello,
My `flake8` gives me a "W605 invalid escape sequence" [1] warning for
this piece of example code.
import re
def foobar():
rex = re.compile('Version: \d+.\d+.\d+.*', re.MULTILINE)
for match in rex.finda
Hello,
My `flake8` gives me a "W605 invalid escape sequence" [1] warning for
this piece of example code.
import re
def foobar():
rex = re.compile('Version: \d+.\d+.\d+.*', re.MULTILINE)
for match in rex.findall(' Version: 1.2.3 '):
print(match)