码迷,mamicode.com
首页 > 编程语言 > 详细

Python3的index()方法

时间:2018-05-30 00:26:31      阅读:264      评论:0      收藏:0      [点我收藏+]

标签:oba   style   tao   索引   family   google   bsp   mil   匹配   

index()函数用于从列表中找出某个值第一个匹配项的索引位置。 

list1 = [Google, Runoob, Taobao]
print("Google的索引值:",list1.index("Google"))
print("Taobao的索引值:",list1.index("Taobao"))
# 输出:
Google的索引值: 0
Taobao的索引值: 2

 

Python3的index()方法

标签:oba   style   tao   索引   family   google   bsp   mil   匹配   

原文地址:https://www.cnblogs.com/gepu1991/p/9108559.html

(0)
(0)
   
举报
评论 一句话评论(0
登录后才能评论!
© 2014 mamicode.com 版权所有  联系我们:gaon5@hotmail.com
迷上了代码!