创建线程方式

class Mythreading(threading.Thread):

    def __init__(self,num):
        threading.Thread.__init__(self)
        self.num = num

    def run(self):
        print("这是线程哦",self.num)
        time.sleep(2)

t1 = Mythreading(1)
t2 = Mythreading(2)

t1.start()
t2.start()
原文地址:https://www.cnblogs.com/TKOPython/p/12435832.html