I'm trying to read the website https://koniewyscigowe.pl/wyscig?w=14222-tor-partynice-nagroda-cheval-francais using a Python script.
My code:
web_content = requests.get('https://koniewyscigowe.pl/wyscig?w=14222-tor-partynice-nagroda-cheval-francais')
soup = BeautifulSoup(web_content.text)
for index, table in enumerate(soup.find_all('div', {'class': 'table-responsive'})):
if index == 0:
pass
elif index == 1:
for starts_stats in table.tbody.find_all('tr'):
print('HERE WE ARE')
When running this code I got an error
AttributeError: 'NoneType' object has no attribute 'find_all'
Object table.tbody
is empty. I can't find any tbody
section in the second div class="table-responsive"
.
When I check how table
looks like before generating an error, I see:
<div class="table-responsive">
<table class="table table-striped table-bordered">
<thead>
<tr>
<th style="text-align:center"></th>
<th style="text-align:center">rekord</th>
<th style="text-align:center">koń</th>
<th style="text-align:center">wiek</th>
<th style="text-align:center">powozacy</th>
<th style="text-align:center">trener</th>
<th style="text-align:center">wygrana</th>
</tr>
</thead>
<tr>
<td style="text-align:center">1</td>
<td style="text-align:center">1'29.30"</td>
<td style="text-align:center"><a href="/horse/171-ukamaya-verderie">Ukamaya Verderie</a></td>
<td style="text-align:center">6</td>
<td style="text-align:center"><a href="/dzokej?d=71-robert-kieniksman">pow. R. Kieniksman</a></td>
<td style="text-align:center"><a href="/trener?t=6-andrzej&najderski">A. Najderski</a></td>
<td style="text-align:center">7 000 zł</td>
</tr>
...
</table>
</div>
It doesn't have a tbody
section. But when I looked in the browser's inspector, I can see it.
Why is it that table
doesn't see tbody
?
Here's the view in the element inspector:
[]