Python 2.7 美联集团"和"x27,;结果集';对象没有属性';查找所有';
我阅读了与我的问题相关的其他线程,但它没有解决问题Python 2.7 美联集团"和"x27,;结果集';对象没有属性';查找所有';,python-2.7,beautifulsoup,findall,Python 2.7,Beautifulsoup,Findall,我阅读了与我的问题相关的其他线程,但它没有解决问题 <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="
<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>
这引起了我的兴趣
AttributeError: 'ResultSet' object has no attribute 'find_all'
cards\u table
是一个表,我使用for
循环对其进行迭代,因此不确定这是导致错误的原因。好的,代码少了一行:
for line in cards_table:
for row in line.find_all('a'):
print row
cards\u table
是一个列表,因此我们必须先对其进行迭代,然后才能对该表使用find\u all
方法 如果这个问题解决了,那么为了结束这个问题,你应该把你的解决方案作为一个答案发布,并接受它…唯一的障碍是我认为这个问题可能必须是48小时前的。。。
for line in cards_table:
for row in line.find_all('a'):
print row