我想为在Windows上运行的python 2.7创建一个简单的“cron”脚本。你们可以回顾一下这些伪代码的一些见解吗?它应该有用吗?
import time
checktime = 60 #halt time in seconds
runtime = 1408954460 #example start timestamp
while True:
nowtime = int(time.time()) #get current timestamp
if nowtime >= runtime:
if myscript():
runtime = x + 24*60*60 #update next start timestamp
else:
time.sleep(checktime) #only check again after "checktime" seconds
让这段代码“永远”运行是否可以?