📜  定时执行的 python 脚本 - Python 代码示例

📅  最后修改于: 2022-03-11 14:46:54.549000             🧑  作者: Mango

代码示例2
from datetime import datetime
from threading import Timer

x=datetime.today()
y=x.replace(day=x.day+1, hour=1, minute=0, second=0, microsecond=0)
delta_t=y-x

secs=delta_t.seconds+1

def hello_world():
    print "hello world"
    #...

t = Timer(secs, hello_world)
t.start()