python---继承的方式启动线程

import threading,time

class MyThread(threading.Thread):
def __init__(self,name):
super().__init__()
self.name = name


def run(self):
time.sleep(1)
# print("%s创建数据"%self.name)
print("创建数据")

for i in range(5):
t = MyThread("name")
t.start()
posted @ 2021-11-18 14:45  王王的王  阅读(41)  评论(0)    收藏  举报