Pra*_*pta 7 python multithreading
我想每秒运行一个函数n。经过一番研究,我弄清楚了这段代码:
import threading
def print_hello():
threading.Timer(5.0, print_hello).start()
print("hello")
print_hello()
Run Code Online (Sandbox Code Playgroud)
print_hello()调用时会每 5 秒创建一个新线程吗?
| 归档时间: |
|
| 查看次数: |
12879 次 |
| 最近记录: |