python 加星标的表达

Posted

tags:

篇首语:本文由小常识网(cha138.com)小编为大家整理,主要介绍了python 加星标的表达相关的知识,希望对你有一定的参考价值。

>>> def f(a, b):
...     print(a, b)
...
>>> f(b=1, *(2,))
2 1
>>> f(a=1, *(2,))
Traceback (most recent call last):
  File "<stdin>", line 1, in <module>
TypeError: f() got multiple values for keyword argument 'a'
>>> f(1, *(2,))
1 2

以上是关于python 加星标的表达的主要内容,如果未能解决你的问题,请参考以下文章