按照老師講的寫的,這是什么錯誤?
Traceback (most recent call last):
? File "D:\imooc\baike_spider\spider_main.py", line 33, in <module>
? ? obj_spider.craw(root_url)
? File "D:\imooc\baike_spider\spider_main.py", line 13, in craw
? ? self.urls.add_new_url(root_url)
? File "D:\imooc\baike_spider\url_manager.py", line 10, in add_new_url
? ? if url not in self.new_urls and url not in self.old_urls:
AttributeError: 'UrlManager' object has no attribute 'new_urls'
? File "D:\cat\imooc\baike_spider\url_manager.py", line 10, in add_new_url
? ? if url not in self.new_urls and url not in self.old_urls:
AttributeError: 'UrlManager' object has no attribute 'new_urls'
2016-02-18
你的UrlManager類里并未定義new_urls屬性
2018-09-12
構(gòu)造函數(shù)def __init__(self):
寫成 def __int__就會出現(xiàn)找不到urls了! init!=int?
2017-11-14
def __init__(self):
? ? ? ? self.new_urls = set()
? ? ? ? self.old_urls = set()
注意你們的__init__不要寫成int,我的就是代碼自動補全寫成了int,最后才發(fā)現(xiàn)
2017-02-16
怎么定義new_urls的屬性
2016-11-23
請問這是怎么解決的?還有這樣的bug!