多线程练习

清华大佬耗费三个月吐血整理的几百G的资源,免费分享!....>>>

import threading
import time
from sys import stdout

class 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')