只能输出一个链接,去掉try....except 后就变成这样了,怎么解决呢
Traceback (most recent call last):
File "C:/Users/Administrator/PycharmProjects/baike_spider/baike_spider/spider_main.py", line 35, in <module>
obj_spider.craw(root_url)
File "C:/Users/Administrator/PycharmProjects/baike_spider/baike_spider/spider_main.py", line 20, in craw
new_urls,new_data=self.parser.parse(new_url,html_cont)
File "C:\Users\Administrator\PycharmProjects\baike_spider\baike_spider\html_parser.py", line 29, in parse
new_urls=self._get_new_urls(page_url,soup)
File "C:\Users\Administrator\PycharmProjects\baike_spider\baike_spider\html_parser.py", line 12, in _get_new_urls
new_full_url=urlparse.urljoin(page_url,new_url)
NameError: global name 'new_url' is not defined