What is *kwargs and **kwargs?



What is *kwargs and **kwargs?..

Answer / Ashutosh Gusain

*kwargs allows you to pass any number of keyword arguments as a tuple, while **kwargs allows you to pass any number of keyword arguments as a dictionary.nnFor example:n```ndef func(*args):n print(args)nndict = {'a': 1, 'b': 2}nfunc(*dict)nfunc(**dict) # prints (1, 2)n```

Is This Answer Correct ?    0 Yes 0 No

Post New Answer

More Python Interview Questions

What does the __ init__ function do in python?

1 Answers  


What is head and tail method for data frames in pandas ?

1 Answers  


Can I learn python in a month?

1 Answers  


What does isalpha do in python?

1 Answers  


What is pyunit in python?

1 Answers  


What are assignment operators in python?

1 Answers  


Explain the use of decorators?

1 Answers  


What does the meaning of slicing in python?

1 Answers  


How do I sort alphabetically in python?

1 Answers  


Why and when do you use generators in python?

1 Answers  


Is python faster than python2?

1 Answers  


Why does delegation performed in Python?

1 Answers  


Categories