多线程练习,,import threa


import threadingimport timefrom sys import stdoutclass mythread(threading.Thread):    def __init__(self,threadname):        threading.Thread.__init__(self, name = threadname)    def run(self):        for i in range(10):            print(self.getName(),i)            time.sleep(1)thread1 = mythread('mythread')thread1.start()running = threading.currentThread()time.sleep(5)for i in range(5):    stdout.write(str(i)+'\t')

评论关闭