如何使用Python 3中的Scheduler类实现多线程?

时间:2018-10-23 07:26:25

标签: multithreading python-3.5

我希望使用Python 3中的Scheduler类并行执行任务。

这是我的代码。

import sched, time
s = sched.scheduler(time.time)

def print_hello():
    print('Hello')

def print_some_times():
    s.enter(1, 1,print_hello)   
    s.run()
    print_some_times()

print_some_times()

当我运行此代码时,它显示错误。 “ RecursionError:调用Python对象时超出了最大递归深度”。 我也想使用上面的代码运行另一个任务。

0 个答案:

没有答案