Quantcast
Channel: Active questions tagged html - Stack Overflow
Viewing all articles
Browse latest Browse all 67497

Beautiful soup finding the first sibling of a known object with a known attribute

$
0
0

I have the following code to select a certain cell in a table element:

tag = soup.find_all('td', attrs={'class': 'I'})

as shown in the attached image 1, I would like to somehow be able to find its first sibling within the same class "even_row". Ideally, the selection would output only the contents of data-seconds, in this case "58". Not every "even_row" class has a element with class I, and some have more than one, so I need to get the value data-seconds only for the "even_row" classes that have the element with class "I"

Any help would be appreciated as I've been banging my head on the wall looking through documentation to no avail.


Viewing all articles
Browse latest Browse all 67497

Trending Articles



<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>