Kwarg 是什么!??
我一直在学习 django 的教程,试图学习这门语言,但我偶然发现了这一点。
如果有人可以发布/指出一个简单的例子来帮助理解为什么以及如何使用它,我将不胜感激。
最佳答案
基于 Keyword arguments' documentation @Ignacio Vazquez-Abrams
指出**kwargs allows you to handle named arguments that you have not defined in advance.
In a function call, keyword arguments must follow positional arguments.
All the keyword arguments passed must match one of the arguments accepted by the function (e.g. actor is not a valid argument for the parrot function), and their order is not important.
关于python - Django 中的 Kwargs,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/5255913/