Tag Archives: takes 1 positional argument but 2 were given

How to Solve Python Error : **kwargs and takes 1 positional argument but 2 were given

In Python’s function definition, you can add * * kwargs to the parameters. In short, the purpose is to allow to add parameters with indefinite parameter names , and pass parameters as dictionary . But the premise is – you must provide the parameter name

For example:

1 class C():
2     def __init__(self, **kwargs):
3         print(kwargs)