是否可以像在 JS 中使用 setTimer 那样在 Python 中以预定义的时间间隔异步执行代码?
例如,Python 中的函数 example() 每 60 秒就会调用一次。我怎样才能做到这一点?
最佳答案
import threading
def printit():
threading.Timer(5.0, printit).start()
print "Hello, World!"
printit()
关于javascript - 是否可以在Python中创建一个类似于JS间隔的函数?,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/58564308/