개발관련
매일 같은 시간에 특정 스크립트가 실행되게 하는 코드
우원우
2024. 12. 20. 16:26
728x90
반응형
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()
728x90
반응형