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)
Similar Posts:
- Python Error-TypeError:takes 2 positional arguments but 3 were given
- TypeError: list indices must be integers or slices, not str
- Python Typeerror: super() takes at least 1 argument (0 given) error in Python
- Python Standard Library: functools (cmp_to_key, lru_cache, total_ordering, partial, partialmethod, reduce, sing…
- Python: `if not x:` VS `if x is not None:` VS `if not x is None:`
- Fatal error: Call-time pass-by-reference has be…
- Python: __ new__ Method and the processing of typeerror: object() takes no parameters
- Python3 urlopen() TypeError: can’t convert ‘bytes’ object to str im…
- How to Solve Mysql missing ERROR 1265: Data truncated for
- [design and development] Python learning notes – Super () argument 1 must be type, not classobj