課程
/后端開發(fā)
/Python
/Python開發(fā)簡(jiǎn)單爬蟲
? ? obj_spider.craw(root_url) 這一行總是報(bào)錯(cuò),我仔細(xì)檢查了一下代碼不知道哪里有問題,爬出來的結(jié)果全是craw failed
2016-07-19
源自:Python開發(fā)簡(jiǎn)單爬蟲 7-6
正在回答
怎么在Eclipse的PyDev中使用debug
craw的方法中有root_url這個(gè)參數(shù)嗎?
沒遇見過,你使用debug了嗎
def?craw(self,root_url): ????????count?=?1 ????????self.urls.add_new_url(root_url) ????????while?self.urls.has_new_url(): ????????????try: ????????????????new_url?=?self.urls.get_new_url() ????????????????print('craw?%d?:?%s'?%(count,new_url)) ????????????????html_cont?=?self.downloader.download(new_url) ????????????????new_urls,new_data?=?self.parser.parse(new_url,html_cont) ????????????????self.urls.add_new_urls(new_urls) ????????????????self.outputer.collect_data(new_data) ????????????????if?count?==?10: ????????????????????break ????????????????count?=?count?+?1 ????????????except?Exception?as?e: ????????????????print('craw?failed',e)???? ????????self.outputer.output_html()
在craw中有root_url這個(gè)參數(shù)嗎?
舉報(bào)
本教程帶您解開python爬蟲這門神奇技術(shù)的面紗
Copyright ? 2025 imooc.com All Rights Reserved | 京ICP備12003892號(hào)-11 京公網(wǎng)安備11010802030151號(hào)
購(gòu)課補(bǔ)貼聯(lián)系客服咨詢優(yōu)惠詳情
慕課網(wǎng)APP您的移動(dòng)學(xué)習(xí)伙伴
掃描二維碼關(guān)注慕課網(wǎng)微信公眾號(hào)
2016-07-31
怎么在Eclipse的PyDev中使用debug
2016-07-28
craw的方法中有root_url這個(gè)參數(shù)嗎?
2016-07-28
沒遇見過,你使用debug了嗎
在craw中有root_url這個(gè)參數(shù)嗎?