python threading 自定义多线程-固定线程执行任务

## 你好

```

from threadingimport Thread 

import threading

def test(a,b):

print('test')

print(a+b,a,b,threading.current_thread())

class myThread (threading.Thread):

def __init__(self, name):

threading.Thread.__init__(self)

self.name = name

def run(self,a,b):

test(a,b)

print ("开始线程:" +self.name,threading.currentThread())

def main():

t=myThread('one')

for in range(5):

a=i+1

        b=i+2

        t.run(a,b)

main()

```

你可能感兴趣的:(python threading 自定义多线程-固定线程执行任务)