Python 元组 index() 方法实例定义和用法语法参数值Python 元组 index() 方法实例检索首次出现的值 8,并返回其位置: thistuple = (1, 3, 7, 8, 7, 5, 4, 6, 8, 5) x = thistuple.index(8) print(x) 定义和用法index() 方法查找指定值的第一次出现。 如果未找到该值,index() 方法将引发异常。 语法tuple.index(value) 参数值 参数 描述 value 必需。要检索的项目。