文章详情页
python - 为什么__del__不执行呢?
问题描述
新手用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报错求助
相关文章:
排行榜