python timer 每隔一段时间执行一次代码
作者:
绛珠仙靖 | 来源:发表于
2019-06-06 12:00 被阅读0次
def timer(interval=600, timeout=18000):
"""every 10min checking, 5hrs"""
n = 1
start_time = None
if start_time == None:
start_time = time.time()
while True:
if time.time() > start_time + timeout:
PlayPage.pause_butt.click()
print("end play" + time.asctime(time.localtime(time.time())))
break
elif (time.time() - start_time) % interval == 0:
print(time.asctime(time.localtime(time.time()))) # checking time
n += 1
PlayPage.tips.is_Element_visible()
本文标题:python timer 每隔一段时间执行一次代码
本文链接:https://www.haomeiwen.com/subject/jebyxctx.html
网友评论