这么写直接弹框报python运行出错,/尴尬,那这个怎么多线程调用getA/getB/getC/getD/getE呢?每次传参还要循环个arg2list列表
class ThreadTest():
def __init__(self):
pass
def getA(self, args1, args2):
pass
def getB(self, args1, args2):
pass
def getC(self, args1, args2):
pass
def getD(self, args1, args2):
pass
def getE(self, args2):
pass
if __name__ == "__main__":
Test = ThreadTest()
args2list = ['table1','table2']
args1 = 2
thread_ = []
for args2 in args2list:
t1 = threading.Thread(target=Test.getA, args = (args1, args2))
t2 = threading.Thread(target=Test.getB, args = (args1, args2))
t3 = threading.Thread(target=Test.getE, args = (args2))
t4 = threading.Thread(target=Test.getC, args = (args1, args2))
t5 = threading.Thread(target=Test.getrace, args = (args1, args2))
thread_.append(t1)
thread_.append(t2)
thread_.append(t3)
thread_.append(t4)
thread_.append(t5)
print(thread_)
for t in thread_:
t.setDaemon(True)
t.start()
t.join()