[英]Timer Object in Python or anything like that
我想在python中跟蹤時間,以便在1周的時間內重新運行模型。 我可以使用:
import threading
def learn_model():
#stuff goes here
p = threading.Timer(604800, learn_model)
1周后會重復嗎?
為了使該代碼完全運行,您需要添加:
p.start()
所以你有了
import threading
def learn_model():
#stuff goes here
p = threading.Timer(604800, learn_model)
p.start()
然后將在一周后執行learn_model中的代碼。 但是,它將只運行一次。
聲明:本站的技術帖子網頁,遵循CC BY-SA 4.0協議,如果您需要轉載,請注明本站網址或者原文地址。任何問題請咨詢:yoyou2525@163.com.