运行后出现craw failed 'NoneType' object has no attribute 'get_text'
敲完代码后运行出现
craw failed 'NoneType' object has no attribute 'get_text'
不知道是哪里出错,仔细检查了好几遍
敲完代码后运行出现
craw failed 'NoneType' object has no attribute 'get_text'
不知道是哪里出错,仔细检查了好几遍
2016-07-14
get_text是在html_parser中的代码吧,你看看是不是_get_new_data中class=后面那串写错了
def _get_new_data(self,page_url, soup):
res_data={}
res_data["url"]=page_url
title_node=soup.find("dd",class_="lemmaWgt-lemmaTitle-title").find("h1")
res_data["title"]=title_node.get_text()
summary_node=soup.find("div",class_="lemma-summary")
res_data["summary"]=summary_node.get_text()
return res_data
举报