1👍
Keyword argument are argument which are passed using their name. For example in the call
foo(1, 3, length=4)
argument 1 and 3 are usual argument whereas length
is a keyword argument. You should read a tutorial such as this one or this official tutorial
0👍
keyword arguments (kwargs) are those represented as a dictionary
{'parameter_name1': value1, 'parameter_name2': value2, ...}
Once you get them in a function func
, you can access to them as kwargs['parameter_name1']
def func(*args, **kwargs):
—-> args: positional arguments, kwargs: keyword arguments
- [Answer]-Select from table with grouping by field and selecting max datetime with Django ORM
- [Answer]-Django Models: Should a relatives model refer to itself through ForeignKey or ManyToMany?
- [Answer]-How to pass in a list of arguments to a custom Django REST Framework API?
- [Answer]-Django foreign key in model
- [Answer]-Extra fields in Django ModelForms: I can see them, but cannot save them to the model. Why?
Source:stackexchange.com