On 9/10/22 13:20, Stefan Ram wrote:
<c.bu...@posteo.jp> 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 more easily
recognized as broken.
Some Python versions may emit a DeprecationWarning when
an unrecognized escape sequence is encountered; future
Python versions might emit a SyntaxWarning or SyntaxError.
Consider:
$ /usr/bin/python3.11 -X dev stuff.py
/tmp/stuff.py:4: DeprecationWarning: invalid escape sequence '\d'
rex = re.compile('Version: \d+.\d+.\d+.*', re.MULTILINE)
Version: 1.2.3
--
https://mail.python.org/mailman/listinfo/python-list