[问题] 网页爬虫

楼主: 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