【发布时间】:2019-07-27 20:20:05
【问题描述】:
我正在查看 python 中 list.index() 方法的文档,我看到的是:
>>> help(list().index)
Help on built-in function index:
index(value, start=0, stop=9223372036854775807, /) method of builtins.list
instance
Return first index of value.
Raises ValueError if the value is not present.
当我运行下面的代码时出现了一些错误。
>>> l=[1,2,3,43,45,5,6,6]
>>> l.index(43,start=1)
Traceback (most recent call last):
File "<stdin>", line 1, in <module>
TypeError: index() takes no keyword arguments
【问题讨论】:
标签: python python-3.x list keyword-argument