Answers for "get list of duplicates python"

9

count the duplicates in a list in python

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)
Posted by: Guest on January-30-2021
-1

list of single item repeated python

list_of_lists = [[] for _ in range(4)]
Posted by: Guest on December-20-2021

Code answers related to "get list of duplicates python"

Python Answers by Framework

Browse Popular Code Answers by Language