import datetime
from threadingimport Timer
def time_printer():
now = datetime.datetime.now()
ts = now.strftime('%Y-%m-%d %H:%M:%S')
print('do func time :', ts)
def loop_monitor(times, fun):
t =Timer(times, fun)
t.start()
loop_monitor(5, time_printer)