【发布时间】:2013-03-30 14:02:23
【问题描述】:
我阅读了与我的问题相关的其他线程,但它并没有解决问题。
<h2 class="tabellen_ueberschrift al">Cards</h2>
<div class="fl" style="width:49%;">
<table class="tabelle_grafik lh" cellpadding="2" cellspacing="1">
<tr>
<th class="al" colspan="3">CA Osasuna</th>
</tr>
<td class="s10 al">
<a href="/en/sisi/profil/spieler_51713.html" class="fb s10" title="Sisi">Sisi</a>
<br />
26. min. 2. yellow card, Time wasting </td>
</tr>
我想在表格中获取所有a 标签(会有几个),所以我的代码是这样的:
header = soup.find('h2', text="Cards")
cards_table = header.find_next_siblings(limit=2)
for row in cards_table.find_all('a'):
print row
这让我很兴奋
AttributeError: 'ResultSet' object has no attribute 'find_all'
cards_table 是一个表,我使用for 循环对其进行迭代,所以不确定为什么会导致错误。请给点意见?
【问题讨论】:
-
如果这个问题得到解决,那么要关闭问题,您应该将您的解决方案作为答案发布,并接受它...
-
唯一的障碍是我认为这个问题可能必须有 48 小时的历史......
标签: python-2.7 beautifulsoup findall