代码如下
import threading
def set_interval(func, sec):
def func_wrapper():
set_interval(func, sec)
func()
t = threading.Timer(sec, func_wrapper)
t.start()
return t
用了 threading 这个多线程的库 ,和 js 还是有一些区别的
有机会用 python 异步的库写一下