我正在实现一个多线程的概念,它将一个块<class 'pandas.core.frame.DataFrame'>
划分成若干块。当我把它作为参数发送到目标函数时,我得到的错误是
TypeError: thread_chunking() takes 2 positional arguments but 3 were given
我尝试在target方法中接收as*args,但它是以tuple的形式给出的,没有只包含标题的内容
我的代码在下面
thread_chunk=pandas.read_sql("some sql here")
....
thread_name= threading.Thread(target=self.thread_chunking,args=thread_chunk[0:100]))
那么如何在python的线程中向目标函数传递
args
是目标调用的参数元组。 试着把它当作:看看能不能用
链接到文档:https://docs.python.org/2/library/threading.html#thread-objects
相关问题 更多 >
编程相关推荐