HTML无效,已中断
BeautifulSoup
在这里修理
....
html_doc = response.text.replace('<table <', '<')
html_doc = re.sub(r'<\!--\s+\d+\s+--\!>', '', html_doc)
html_doc = re.sub(r'</?font.*?>' ,'', html_doc)
soup = BeautifulSoup(html_doc, "html.parser")
trs= soup.findAll('table')[8].findAll('tr')
print (len(trs))
注:使用
lxml
返回7而不是22