1. Anuncie Aqui ! Entre em contato fdantas@4each.com.br

[Python] How to improve python code with regular expression? [duplicate]

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

  1. Stack

    Stack Membro Participativo

    I have to find strings that starts from var actual = " and ends with " in html code

    My code is working

    import re

    s = """
    some htmlcode
    var actual = "https://url1.com"
    var actual = "https://url2.com"
    """
    compiled = re.compile(r'var actual = "(.*)(?=")')
    match = compiled.findall(s)
    print(match)



    What is the optimal way (in terms of time) to solve the problem with python?

    Continue reading...

Compartilhe esta Página