[Answer]-What is a keyword argument in python?

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

👤hivert

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

Leave a comment