1. This site uses cookies. By continuing to use this site, you are agreeing to our use of cookies. Learn More.
  2. Anuncie Aqui
    Anuncie aqui você Também: fdantas@4each.com.br

[Python] python3.12.3 print warning when use \d to match numbers [duplicate]

Discussão em 'Python' iniciado por Stack, Setembro 13, 2024.

  1. Stack

    Stack Membro Participativo

    I upgrade python to 3.12.3, below code report a warning:

    SyntaxWarning: invalid escape sequence '\d'


    Does python still support \d to match numbers?

    import re

    s = "hello 123"

    m = re.search("(?P<val>[\d]+)",s)
    if m:
    print(m['val'])

    Continue reading...

Compartilhe esta Página