如题,照著书上的教学作测试,得到预期外的结果
(使用Python3.4, OS windows 8.1)
书本爬这个网页作范例
https://goo.gl/Htv4bm
也提供了程式码供下载
https://goo.gl/Qjz2eN
预期只会得到清单的各个名称
Vegetable Basket
Russian Nesting Dolls
...(略)
span等等的那些也都抓到了,同样测试了descendants及next_siblings,也得到奇怪的结果
请问是我对预期的结果有误会吗?以下附上一部份测试得到的结果
再麻烦解答,谢谢
<tr><th>
Item Title
</th><th>
Description
</th><th>
Cost
</th><th>
Image
</th></tr>
<tr class="gift" id="gift1"><td>
Vegetable Basket
</td><td>
This vegetable basket is the perfect gift for your health conscious (or
overweight) friends!
<span class="excitingNote">Now with super-colorful bell peppers!</span>
</td><td>
$15.00
</td><td>
<img src="../img/gifts/img1.jpg"/>
</td></tr>
<tr class="gift" id="gift2"><td>
...
(略,id = gift1~gift5都有列出来,格式同上)