__call__() takes from 1 to 2 positional arguments but 3 were given
时间: 2023-12-05 08:38:03 浏览: 63
这个错误提示是因为你在调用某个函数时传入了3个参数,但是该函数只接受1到2个参数。你需要检查一下你的代码,看看是哪个函数出了问题。可能是你在调用函数时传入了多余的参数,或者是函数定义时参数个数不正确。你可以尝试修改代码,确保传入的参数个数正确,或者修改函数定义,使其接受更多的参数。如果你仍然无法解决问题,可以尝试查看相关文档或寻求其他开发者的帮助。
相关问题
raw_input() takes from 1 to 2 positional arguments but 3 were given
This error message indicates that the function raw_input() was called with three arguments, but it only accepts one or two arguments.
The most common cause of this error is passing too many arguments to the function. For example, if you try to call raw_input() with three strings as arguments, like this:
raw_input("Enter your name: ", "Enter your age: ", "Enter your gender: ")
You will get the "takes from 1 to 2 positional arguments but 3 were given" error message, because raw_input() only accepts one or two arguments.
To fix this error, you need to pass the correct number of arguments to the function. In the case of raw_input(), you should only pass one argument if you want to display a prompt message, like this:
name = raw_input("Enter your name: ")
Or you can call the function without any arguments, like this:
name = raw_input()
python __call__() takes from 1 to 2 positional arguments but 3 were given
这个错误提示表明在调用一个Python类的实例时,传递的参数数量不正确。具体来说,这个类定义了一个__call__()方法,但是在调用这个实例时,传递了比这个方法定义的参数数量多的参数。可能的原因是在调用这个实例时,传递了不必要的参数或者忘记了传递必要的参数。需要检查代码并确保传递的参数数量与方法定义的参数数量相匹配。
相关推荐
![pdf](https://img-home.csdnimg.cn/images/20210720083512.png)
![zip](https://img-home.csdnimg.cn/images/20210720083736.png)
![rar](https://img-home.csdnimg.cn/images/20210720083606.png)
![](https://csdnimg.cn/download_wenku/file_type_ask_c1.png)
![](https://csdnimg.cn/download_wenku/file_type_ask_c1.png)
![](https://csdnimg.cn/download_wenku/file_type_ask_c1.png)
![](https://csdnimg.cn/download_wenku/file_type_ask_c1.png)
![](https://csdnimg.cn/download_wenku/file_type_ask_c1.png)
![](https://csdnimg.cn/download_wenku/file_type_ask_c1.png)
![](https://csdnimg.cn/download_wenku/file_type_ask_c1.png)
![](https://csdnimg.cn/download_wenku/file_type_ask_c1.png)
![](https://csdnimg.cn/download_wenku/file_type_ask_c1.png)
![](https://csdnimg.cn/download_wenku/file_type_ask_c1.png)
![](https://csdnimg.cn/download_wenku/file_type_ask_c1.png)
![](https://csdnimg.cn/download_wenku/file_type_ask_c1.png)
![](https://csdnimg.cn/download_wenku/file_type_ask_c1.png)
![](https://csdnimg.cn/download_wenku/file_type_ask_c1.png)