python列表中重复元素的index怎样一一列出
发布网友
发布时间:2022-04-23 04:27
我来回答
共1个回答
热心网友
时间:2023-06-24 04:44
#!usr/bin/python
resList = [];
resList1 = [1,2,3,1,3]
resList2 = []
for i in range(len(resList1)):
if(resList1.count(resList1[i]) >=2 ):
if(resList2.count(resList1[i]) >= 1):
continue
else:
resList2.append(resList1[i])
print resList2