教程集 www.jiaochengji.com
教程集 >  Python编程  >  Python入门  >  正文 在Python中如何获取元素在数组中的索引号?

在Python中如何获取元素在数组中的索引号?

发布时间:2021-12-30   编辑:jiaochengji.com
教程集为您提供在Python中如何获取元素在数组中的索引号?等资源,欢迎您收藏本站,我们将为您提供最新的在Python中如何获取元素在数组中的索引号?资源

在Python中如何获取元素在数组中的索引号?

具体如下:

这里python是通过index方法获取索引号的

<pre class="brush:php;toolbar:false">li = ['a', 'b', 'new', 'D', 'z', 'example', 'new', 'two', 'elements'] print li.index("example") print li.index("new") print li.index("z") print "c" in li</pre>

运行结果如下:

<pre class="brush:php;toolbar:false">5 2 4 False</pre>

您可能感兴趣的文章:
在Python中如何获取元素在数组中的索引号?
python tuple和list的区别是什么
Jquery 获取对象的几种方式介绍
Jquery 获取对象的多种方式
进来吧,给自己10分钟,这篇文章带你直接学会python
我要如何在HTML中建立<form>数组?
perl和python区别是什么
php获得数组长度(元素个数)的方法
jquery获取元素索引值index()示例
jQuery学习笔记 获取jQuery对象

[关闭]
~ ~