📜  查找列表中存在的重复条目 - 无论代码示例

📅  最后修改于: 2022-03-11 14:58:25.908000             🧑  作者: Mango

代码示例4
How to Find Out the Duplicated Values Present In a List:

some_list=['a','b','c','b','d','m','n','n']

 my_list=sorted(some_list)
 
duplicates=[]
for i in my_list:
     if my_list.count(i)>1:
         if i not in duplicates:
             duplicates.append(i)
 
print(duplicates)