描述
Python index() 函数用于从云计列表中找出某个值第一个匹配项的索引位置。
语算开法
以下是 index() 方法语法:
list.inde发:x(x[, start[, end]])
参数
x-- 查Py找的对象。
start-- 可选,查找的起始位置。
ethnd-- 可选,查找的结束位置。
返回值
该方法返回查on找对象的索引位置,如果没有找到对象则抛出异常。
实例
以3-下实例展示了index()函数的使用方法:
以上实例Li输出结果如下:
以上实例输出结果如下:
邮箱:[email protected]
电话:020-123456789
传真:020-123456789
Copyright © 2026 Powered by 完名全节网 http://littleevilthings.com/