Re: Correct syntax for pathological re.search()

Liste des GroupesRevenir à cl python 
Sujet : Re: Correct syntax for pathological re.search()
De : python (at) *nospam* mrabarnett.plus.com (MRAB)
Groupes : comp.lang.python
Date : 08. Oct 2024, 23:10:03
Autres entêtes
Message-ID : <mailman.11.1728425592.4695.python-list@python.org>
References : 1 2 3 4 5 6 7
User-Agent : Mozilla Thunderbird
On 2024-10-08 21:59, Alan Bawden via Python-list wrote:
Karsten Hilbert <Karsten.Hilbert@gmx.net> writes:
             Python 3.11.2 (main, Aug 26 2024, 07:20:54) [GCC 12.2.0] on linux
            Type "help", "copyright", "credits" or "license" for more information.
            >>> tex = '\sout{'
            >>> tex
            '\sout{'
            >>>
     Am I missing something ?
 You're missing the warning it generates:
          > python -E -Wonce
         Python 3.11.2 (main, Aug 26 2024, 07:20:54) [GCC 12.2.0] on linux
         Type "help", "copyright", "credits" or "license" for more information.
         >>> tex = '\sout{'
         <stdin>:1: DeprecationWarning: invalid escape sequence '\s'
         >>>
You got lucky that \s in invalid. If it had been \t you would've got a tab character.
Historically, Python treated invalid escape sequences as literals, but it's deprecated now and will become an outright error in the future (probably) because it often hides a mistake, such as the aforementioned \t being treated as a tab character when the user expected it to be a literal backslash followed by letter t. (This can occur within Windows file paths written in plain string literals.)

Date Sujet#  Auteur
7 Oct 24 * Correct syntax for pathological re.search()28Michael F. Stemper
7 Oct 24 +* Re: Correct syntax for pathological re.search()6Stefan Ram
7 Oct 24 i`* Re: Correct syntax for pathological re.search()5Michael F. Stemper
7 Oct 24 i `* Re: Correct syntax for pathological re.search()4Stefan Ram
7 Oct 24 i  +- Re: Correct syntax for pathological re.search()1Jon Ribbens
8 Oct 24 i  `* Re: Correct syntax for pathological re.search()2Pieter van Oostrum
9 Oct 24 i   `- Re: Correct syntax for re.search() (Posting On Python-List Prohibited)1Lawrence D'Oliveiro
8 Oct 24 +- Re: Correct syntax for pathological re.search()1Karsten Hilbert
8 Oct 24 +- Re: Correct syntax for pathological re.search()1MRAB
8 Oct 24 +* Re: Correct syntax for pathological re.search()3MRAB
8 Oct 24 i`* Re: Correct syntax for pathological re.search()2Stefan Ram
8 Oct 24 i `- Re: Correct syntax for pathological re.search()1Stefan Ram
8 Oct 24 +* Re: Correct syntax for pathological re.search()4Karsten Hilbert
8 Oct 24 i`* Re: Correct syntax for pathological re.search()3Alan Bawden
9 Oct 24 i +- Re: Correct syntax for pathological re.search()1MRAB
9 Oct 24 i `- Re: Correct syntax for pathological re.search()1Karsten Hilbert
11 Oct 24 +- Re: Correct syntax for pathological re.search()1<avi.e.gross
12 Oct 24 +- Re: Correct syntax for pathological re.search()1MRAB
12 Oct 24 +* Re: Correct syntax for pathological re.search()2Peter J. Holzer
12 Oct 24 i`- Re: Correct syntax for pathological re.search()1Stefan Ram
12 Oct 24 +- Re: Correct syntax for pathological re.search()1Thomas Passin
12 Oct 24 +- Re: Correct syntax for pathological re.search()1<avi.e.gross
12 Oct 24 +- Re: Correct syntax for pathological re.search()1Thomas Passin
13 Oct 24 +- Re: Correct syntax for pathological re.search()1Stefan Ram
18 Oct 24 `* Re: Correct syntax for pathological re.search()4Peter J. Holzer
19 Oct 24  `* Re: Correct syntax for pathological re.search()3jak
21 Oct 24   `* Re: Correct syntax for pathological re.search()2Peter J. Holzer
21 Oct 24    `- Re: Correct syntax for pathological re.search()1Stefan Ram

Haut de la page

Les messages affichés proviennent d'usenet.

NewsPortal