I have several blocks like this one in one HTML file:
<div class="pro">
<div>
<h1> TITLE</h1>
<p> DESCRIPTION</p> **<= Point 1**
<div class="wrapper-pro..." ...>
<select name="input_1" id="input_1" aria-describedby="status_1">
<option value="option">Select an option</option>
<option value="true"> TRUE</option>
<option value="false" selected="true"> FALSE</option> **<= Point 2**
</select>
<div class="indicator-container">
<span class="status OK" ...>
<span class="sr">OK</span><span class="status-icon" aria-hidden="true"/> **<= Point 3**
</span>
</div>
<p class="answer" id="answer_1"/>
</div></div>
For each block, I would like to extract the 3 points I identified in the below code.
- Point 1: I want ‘DESCRIPTION’. I already can do it by with
pro = soup.find_all("div", class_="pro")
- Point 2: I want to extract only the “selected value” (here is false value)
- Point 3: I want to extract the status OK.
Could you please help to decompose all action. I know how to do the point 1 because there is only 1 step. But I don’t know how to do when we have several steps.
New contributor
smilorel is a new contributor to this site. Take care in asking for clarification, commenting, and answering.
Check out our Code of Conduct.