解决python list列表查找重复值的下标值问题
2018-02-07 20:52
441 查看
#!/usr/bin/env python # !_*_ coding:utf-8 _*_ """ @version: python2.7 @license: Apache Licence @contact: longzinziyan@gmail.com @site: http://blog.csdn.net/dielian520 @software: PyCharm @time: 18-2-7 下午6:21 """ a = [8, 1, 5, 6, 8, 7, 8, 4, 8, 2, 5, 4, 8, 6, 5, 4, 8, 7, 5, 2, 8, 8, 8] temp = 8 flag = 0 list_index = [] for n in range(a.count(temp)): sec = flag flag = a[flag:].index(temp) list_index.append(flag + sec) flag = list_index[-1:][0] + 1 print(list_index)
相关文章推荐
- 解决学生信息管理系统之List列表中重复添加相同数据问题。
- nullnullPython 在列表list中查找相应的值
- dede列表分页问题解决Pagelist标签详解
- 【Python】【List】去除列表中重复的元素
- 在Markdown中紧跟list列表后的四空格缩进代码被错误解析问题与解决方法
- 去除List列表中重复值(3种解决方法)
- python解决字典中的值是列表问题的方法
- python list 去重重复元素问题
- python提交表单时属性名重复问题的解决
- Python删除列表重复数据以及效率问题
- python list列表删除元素需要注意的问题
- js解决列表中按钮重复点击重复提交的问题
- python 中 list 列表 的十种操作方法:添加,插入,弹出,删除,延长,运算,查找,排序,反转,采用递归函数深度遍历list
- <c:foreach>解决遍历一个list创建多行多列列表的问题
- 使用Volley来写一个List列表(Valley可以解决很大一部分android请求server的问题)
- python解决字典中的值是列表问题的方法
- python解决字典中的值是列表问题的方法
- [Python] 专题五.列表基础知识 二维list排序、获取下标和处理txt文本实例
- Python 在列表list中查找特定的值
- 去除List列表中重复值(3种解决方法)