这么写直接弹框报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()
这是一个专为移动设备优化的页面(即为了让你能够在 Google 搜索结果里秒开这个页面),如果你希望参与 V2EX 社区的讨论,你可以继续到 V2EX 上打开本讨论主题的完整版本。
V2EX 是创意工作者们的社区,是一个分享自己正在做的有趣事物、交流想法,可以遇见新朋友甚至新机会的地方。
V2EX is a community of developers, designers and creative people.