Even if I haven’t put enough information in, I’ll demonstrate how easy it is to do this with the Beautifulsoup.
Beautifulsoup is a webscrapping-focused library in HTML and XML data search. Use is simple. In case, after installing (pip install bs4
), you import in bs4 the main class Beautifulsoup and install it with an html and a parser of preference (such as html parser. or the lxml).
To find a specific tag, enter the minimum number of information to find that single tag instead of several of the same type.
Translating to a ready code would be:
from bs4 import BeautifulSoup
textoHTML = '<html><head></head><body><input aria-required="true" autocomplete="given-name" class="give-input required" id="descricao" name="descricao" placeholder="First Name" required="" type="text" value="Roberta Bellamy"/></body></html>' #SEU HTML ARQUI
soup = BeautifulSoup(textoHTML, 'html.parser')
print(soup.find("input", class_=['given-input', 'required'], id='descricao'))
# IMPRIME: <input aria-required="true" autocomplete="given-name" class="give-input required" id="descricao" name="descricao" placeholder="First Name" required="" type="text" value="Roberta Bellamy"/>
Here is the input I want to assign a variable to it: <input class="Give-input required" type="text" name="Description" autocomplete="Given-name" placeholder="First Name" id="Description" value="Roberta Bellamy" required="" Aria-required="true">
– Jonas Costa
Welcome to Sopt, I recommend stopping by tour, and read a little about the Minimum, Complete and Verifiable to create questions. The way it is, the code cannot be reproduced and tested. What have you managed to do?
– Breno
But regardless of what the full HMTL and its code is, I believe you can use regex, string manipulation or even the library Beautifulsoup.
– Breno