import threading
class prthread(threading.Thread):
def __init__(self,thid,thname,s):
threading.Thread.__init__(self)
self.thid = thid
self.thname = thname
self.s = s
def run(self):
# print('start'+self.thname)
pr(self.thname,self.s)
def pr(tname,s):
for i in range(s,s+5):
print('%s:%d'%(tname,i))
for i in range(1,75,15):
th1 = prthread(1,'th1',i)
if i < 70 :
th2 = prthread(2,'th2',i+5)
if i < 65 :
th3 = prthread(3,'th3',i+10)
th1.start()
th2.start()
th3.start()
大概就是这么实现的吧..0.0