文章詳情頁
python - 為什么__del__不執(zhí)行呢?
瀏覽:83日期:2022-08-08 18:17:16
問題描述
新手用python2.7寫的一個scrapy爬蟲,希望爬蟲退出去的時候清理打開的firefox進程,發(fā)現(xiàn)不管用,請幫忙看下,為什么最下面的self.browser.quit不執(zhí)行呢
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可以調(diào)用多次acquire下一條:python - scrapy pipeline報錯求助
相關文章:
排行榜

熱門標簽