python 列表返回重复数据的下标
class Solution(object):
def searchRange(self, nums, target):
"""
:type nums: List[int]
:type target: int
:rtype: List[int]
"""
flag = 0
lis = []
for i in range(nums.count(target)):
sec = flag
flag = nums[flag:].index(target)
lis.append(flag + sec)
flag = lis[-1:][0] + 1
return lis
so = Solution()
print so.searchRange([5,7,7,8,8,10,8], 8)