gepu1991

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

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

 

分类:

技术点:

相关文章:

  • 2021-12-19
  • 2021-12-19
  • 2021-12-19
  • 2021-12-15
  • 2021-12-15
  • 2021-07-07
  • 2022-03-02
  • 2021-08-24
猜你喜欢
  • 2021-12-19
  • 2021-12-19
  • 2021-06-15
  • 2021-07-25
  • 2021-12-19
  • 2021-12-19
相关资源
相似解决方案