I'm trying to get only one item from a list of tags:
Here is a sample of the code, simplified :
<table>
<tbody>
<tr>Intro</tr>
<tr>
<td>First data</td>
<td>Second data</td>
<td>Third data</td>
<td>Fourth data</td>
</tr>
<tr>
<td>First data</td>
<td>Second data</td>
<td>Third data</td>
<td>Fourth data</td>
</tr>
</tbody>
</table>
I'm interested only in "Second data" and "Third data"
Here's what I have:
table = soup.find_all("table")
children_tr = table[3].findChildren("tr")
for child_td in children_tr[1:]:
for child in child_td:
try:
print(child)
except AttributeError:
print("")
Like this I can get in order
First data
Second data
Third data
Fourth data
I can't figure out how to get only "First data" and "Second data"
Edit: there are multiple from which I need the first and second