I am looking to use beutifulsouop to extract text in the span
section with a particular class
value, and also the div
section with a different class
value while preserving order.
The following works with the exception that it does not preserve the order [i.e. the list has all of the div
elements at the end, rather than when they occur in the page]
extract = soup.findAll('span', {"class": "value1"})
extract += soup.findAll('div', {"class": "value2"})
Note - this is similar, but slightly different to the question - BeautifulSoup findAll() given multiple classes? as i am specifically looking in span
and div
codes.