python-列表排重并列出重复项和重复项最小索引
list1=[10,11,12,11,12,13,15,13,14,15]
list2=[]
list3=[]
list4=[]
for i in list1:
if i not in list2:
list2.append(i)
else:
list3.append(i)
list4.append(list1.index(i))
print(list2)
print(list3)
print(list4)
list1=[10,11,12,11,12,13,15,13,14,15]
list2=[]
list3=[]
list4=[]
for i in list1:
if i not in list2:
list2.append(i)
else:
list3.append(i)
list4.append(list1.index(i))
print(list2)
print(list3)
print(list4)