函数定义中的星号和反斜杠号
型参列表中*的作用
*的作用>>> def func(a, *, b):
... print(a, b)
...
>>> func(1, 2)
Traceback (most recent call last):
File "<stdin>", line 1, in <module>
TypeError: func() takes 1 positional argument but 2 were given
>>> func(1, b=2)
1 2
>>>型参列表中/的作用
/的作用最后更新于