How to get duplicate tuples from a list of tuples in Python

1 Answer

0 votes
lst_tpl = [(1, 2), (3, 4), (3, 4), (5, 6), (3, 4), (1, 2)] 
  
result = list(set([e for e in lst_tpl if lst_tpl.count(e) > 1])) 
  
print(str(result)) 



'''
run:

[(1, 2), (3, 4)]

'''

 



answered Dec 16, 2019 by avibootz
...