This is what the HTML looks like:
<p class="details"> <span>detail1</span> <span class="number">1</span> <span>detail2</span> <span>detail3</span> </p>
I need to extract detail2 and detail3.
But using this code, I can only get detail1.
info = data.find("p", class_ = "details").span.text
How do I extract the required items?
Thanks in advance!
In your case, select a more specific element, i.e. select all sibling elements of a element with class number:
Example
Output
You can find all
<span>
and do a normal index:Output result:
Or use CSS selector:
Output result: