文章详情页
python - 为什么__del__不执行呢?
浏览:255日期: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. html - Python2 BeautifulSoup 提取网页中的表格数据及连接2. web服务器 - ubuntu下布置apache加wsgi加python3. MYSQL 运算的问题4. 求救一下,用新版的phpstudy,数据库过段时间会消失是什么情况?5. mysql - 数据库中的引擎和表的引擎的区别在哪?6. mysql - 一个sql的问题7. python - 使用pyinstaller 可以添加指定的模块吗?8. node.js - win10如何安装并使用babel?9. javascript - 如图,百度首页,查看源代码为什么什么都没有?10. python - requests post问题
排行榜

网公网安备