[問題] 網頁爬蟲

作者: TimJack (飽喀喀)   2018-07-28 14:18:28
各位大大好
請問以下code:
from urllib.request import urlopen
from bs4 import BeautifulSoup
html_doc ='http://www.twse.com.tw/fund/BFI82U'
soup = BeautifulSoup(html_doc,'html.parser')
for i in soup.body.tbody.find_all('tr'):
print(i.td.get_text())
列印如下錯誤:
AttributeError Traceback (most recent call last)
<ipython-input-22-f987a99b5e34> in <module>()
4 soup = BeautifulSoup(html_doc,'html.parser')
作者: vi000246 (Vi)   2018-07-28 14:20:00
body是None 所以取不到tbody

Links booklink

Contact Us: admin [ a t ] ucptt.com