小编Jan*_*ora的帖子

Python 3.5 TypeError:为参数获取了多个值

def f(a, b, *args):
    return (a, b, args)

f(a=3, b=5)  
(3, 5, ())
Run Code Online (Sandbox Code Playgroud)

然而:

f(a=3, b=5, *[1,2,3])  
TypeError: got multiple values for argument 'b'
Run Code Online (Sandbox Code Playgroud)

为什么会这样?
任何特殊原因?

python args optional-arguments python-3.x

5
推荐指数
1
解决办法
1980
查看次数

标签 统计

args ×1

optional-arguments ×1

python ×1

python-3.x ×1