__init__() got an unexpected keyword argument 'shape'
时间: 2023-10-01 08:02:08 浏览: 48
This error message typically occurs when you try to instantiate an object of a class with an unexpected keyword argument. In this case, it seems that you are trying to pass a keyword argument called 'shape' to the __init__() method of a class, but this argument is not defined in the class.
To fix this error, you need to make sure that the class constructor (__init__() method) accepts the 'shape' keyword argument. You can do this by adding a parameter called 'shape' to the method signature, like this:
```
class MyClass:
def __init__(self, shape):
# constructor code here
```
Then, when you create an instance of the class, you can pass the 'shape' argument as a keyword argument, like this:
```
my_obj = MyClass(shape='square')
```
Make sure that the class definition and the instantiation code match the expected parameter names and types.
相关推荐
![pdf](https://img-home.csdnimg.cn/images/20210720083512.png)
![rar](https://img-home.csdnimg.cn/images/20210720083606.png)
![pdf](https://img-home.csdnimg.cn/images/20210720083512.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)
![pdf](https://img-home.csdnimg.cn/images/20210720083512.png)
![pdf](https://img-home.csdnimg.cn/images/20210720083512.png)
![pdf](https://img-home.csdnimg.cn/images/20210720083512.png)
![pdf](https://img-home.csdnimg.cn/images/20210720083512.png)
![run](https://img-home.csdnimg.cn/images/20210720083646.png)
![zip](https://img-home.csdnimg.cn/images/20210720083736.png)