#!/usr/bin/env python
#-- encoding:utf-8 --
import time
def task():
print (
"task ...")
def timer(n):
while True:
print (time.strftime(
'%Y-%m-%d %X',time.localtime()))
task()
time.sleep(n)
if __name__ ==
'__main__':
timer(5)
转载于:https://www.cnblogs.com/Arvin-9/p/5055467.html
相关资源:Python定时任务随机时间执行的实现方法