2024-06-28 11:44:28 发布
网友
我的程序中有一个线程,它调用一个返回多个值的函数,它还包含一个数据帧,我如何才能得到这些值?从for循环调用线程
ml1234=threading.Thread(target=load_syscom_ascii(fleName=fl, columns=self.cols, finalcsv=self.finalcsv, out=self.outdir)) ml1234.start() head, dfg, df1 =ml1234.join()
首先,创建线程对象时不应该调用目标函数,应该分别传递函数和参数,如:
ml1234 = threading.Thread(target=load_syscom_ascii, kwargs={'fileName': fl, 'columns': self.cols, 'finalcsv': self.finalcsv, 'out': self.outdir})
否则将立即在主线程中调用该函数。在
从线程获取返回值的方法列在这个答案中-how to get the return value from a thread in python?,正如已经建议的那样。在
首先,创建线程对象时不应该调用目标函数,应该分别传递函数和参数,如:
ml1234 = threading.Thread(target=load_syscom_ascii, kwargs={'fileName': fl, 'columns': self.cols, 'finalcsv': self.finalcsv, 'out': self.outdir})
否则将立即在主线程中调用该函数。在
从线程获取返回值的方法列在这个答案中-how to get the return value from a thread in python?,正如已经建议的那样。在
相关问题 更多 >
编程相关推荐