终于搞了出来,总结一下,希望多些不同类型的爬虫教程,更希望和现在移动互联网api 相结合,从后端开发到前端调用,flask,mongoDB,等结合一下
2016-01-13
应该是这样的:
def add_new_url(self, url):
if url is None:
raise Exception # 为None抛出异常
else:
self.new_urls.add(url)
def add_new_urls(self, urls):
if urls is None:
raise Exception
for url in urls:
try:
self.add_new_url(url)
except Exception:
continue # 遇到为None的直接忽视
def add_new_url(self, url):
if url is None:
raise Exception # 为None抛出异常
else:
self.new_urls.add(url)
def add_new_urls(self, urls):
if urls is None:
raise Exception
for url in urls:
try:
self.add_new_url(url)
except Exception:
continue # 遇到为None的直接忽视
2016-01-06