文章详情页
python - 为什么__del__不执行呢?
浏览:79日期:2022-08-08 18:17:16
问题描述
新手用python2.7写的一个scrapy爬虫,希望爬虫退出去的时候清理打开的firefox进程,发现不管用,请帮忙看下,为什么最下面的self.browser.quit不执行呢
def __init__(self):self.browser = webdriver.Firefox() def __del__(self):self.browser.quit()
问题解答
回答1:def spider_closed(self, spider): dosomething()
似乎在scrapy中会建议你这么做scrapy: Call a function when a spider quits
上一条:threadingtest - python threading中的lock rlock 为何rlock可以调用多次acquire下一条:python - scrapy pipeline报错求助
相关文章:
1. sass - gem install compass 使用淘宝 Ruby 安装失败,出现 4042. javascript - js 对中文进行MD5加密和python结果不一样。3. mysql里的大表用mycat做水平拆分,是不是要先手动分好,再配置mycat4. window下mysql中文乱码怎么解决??5. javascript - h5上的手机号默认没有识别6. python - (初学者)代码运行不起来,求指导,谢谢!7. html5 - H5 SSE的本质是什么?8. python - 获取到的数据生成新的mysql表9. python的文件读写问题?10. 为什么python中实例检查推荐使用isinstance而不是type?
排行榜
