源码如下:
import os,time
import sys
def DeltaSeconds():
SECONDS_PER_DAY = 24 * 60 * 60
from datetime import datetime, timedelta
curTime = datetime.now()
desTime = curTime.replace(hour=19, minute=7, second=1, microsecond=0) #这里添加时间
delta = desTime - curTime
skipSeconds = delta.total_seconds() % SECONDS_PER_DAY
print "Must sleep %d seconds" % skipSeconds
return skipSeconds
while True:
s = DeltaSeconds()
time.sleep(s)
print "work it!" #这里可以替换成作业
文章来源: http://blog.csdn.net/utopia_1919