【Python】Python3 List index()方法
来源:互联网 发布:网络高科技犯罪电视剧 编辑:程序博客网 时间:2024/06/05 16:28
描述 index()
函数用于从列表中找出某个值第一个匹配项的索引位置。
语法 index()
方法语法:
list.index(obj)
参数
- obj–查找的对象。
返回值
该方法返回查找对象的索引位置,如果没有找到对象则抛出异常。
实例
以下实例展示了index()
函数的使用方法:
list1 = ['Google', 'Runoob', 'Taobao']print("Google的索引值:",list1.index("Google"))print("Taobao的索引值:",list1.index("Taobao"))
以上实例输出结果如下:
Google的索引值: 0Taobao的索引值: 2
阅读全文
1 0
- 【Python】Python3 List index()方法
- Python List index()方法
- Python List index方法
- 【Python】Python3 List max()方法
- 【Python】Python3 List min()方法
- 【Python】Python3 List append()方法
- 【Python】Python3 List count()方法
- 【Python】Python3 List insert()方法
- 【Python】Python3 List pop()方法
- 【Python】Python3 List remove()方法
- 【Python】Python3 List reverse()方法
- 【Python】Python3 List sort()方法
- 【Python】Python3 List clear()方法
- 【Python】Python3 List copy()方法
- Python index()方法和Python List index()方法
- Python list index method
- 【Python】Python3 List 列表复制
- 整理Python find()、Python index()和Python List index()
- java对象与json对象间的相互转换
- JAVA
- linux 常用命令分类整理
- 【广告算法工程师入门 5】百度搜索引擎变现策略指标体系
- Python 安装 第三方库的安装技巧
- 【Python】Python3 List index()方法
- JSP/Servlet 工作原理
- 全志R16平台的Android6系统下调通rtl8189es
- android自定义Dialog
- 适配iOS11
- vs2005 warning C4267: 'initializing' : conversion from 'size_t' to 'int', possible loss of data
- 程序员的江湖,黑话一定要牢记
- Linux下使用FIO测试磁盘的IOPS
- iOS开发技巧之:图片压缩成指定的大小