python 创建多线程后 如何关闭? 比如一个类
import time
class main:
def run(self):
“some code here” #创建多线程
while True:
main().run()
这里有没有办法写代码把上面创建的线程关闭?
time.sleep(1)
你这段代码只是新建了一个对象并调用它的代码,并没有多线程。建议你阅读python官方指南关于threading模块的用法。