下一节:Python 简介 Python 列表 index() 方法 Python 列表/数组方法实例值 "cherry" 的位置是: fruits = ['apple', 'banana', 'cherry'] x = fruits.index("cherry") 运行实例定义和用法index() 方法返回指定值首次出现的位置。语法list.index(element)参数值参数描述element必需。任何类型(字符串、数字、列表等)。要搜索的值。更多实例实例值 32 的位置是: fruits = [4, 55, 64, 32, 16, 32] x = fruits.index(32) 运行实例注释:index() 方法仅返回值的首次出现。Python 列表/数组方法 下一节:Python 简介