【发布时间】:2018-02-21 18:34:33
【问题描述】:
我正在从 10 万个系统 URL(example.com/entry/1 > example.com/entry/100000)中抓取内容。
但是,大约 10% 的 URL 已被删除,这意味着当脚本到达它们时,它会给我错误“urllib2.httperror http 错误 404”并停止运行。
我对 python 比较陌生,想知道是否有办法做这样的事情:
if result == error:
div_text = "missing"
这样循环可以继续到下一个 URL,但记下它失败了。
【问题讨论】:
标签: python python-2.7 web-scraping beautifulsoup