发布时间:2019-09-25 08:21:37编辑:auto阅读(2359)
import datetime
import time
def doSth():
print('test')
# 假装做这件事情需要一分钟
time.sleep(60)
def main(h=0, m=0):
'''h表示设定的小时,m为设定的分钟'''
while True:
# 判断是否达到设定时间,例如0:00
while True:
now = datetime.datetime.now()
# 到达设定时间,结束内循环
if now.hour==h and now.minute==m:
break
# 不到时间就等20秒之后再次检测
time.sleep(20)
# 做正事,一天做一次
doSth()
main()
上一篇: Python那么火,到底能用来做什么?我
下一篇: python3-ascii与Unicod
51270
50709
41310
38127
32586
29494
28349
23211
23181
21505
1580°
2302°
1910°
1851°
2167°
1892°
2582°
4321°
4171°
2976°