About 7,490,000 results
Open links in new tab
  1. How to Find Duplicates in a ListPython | GeeksforGeeks

    Nov 27, 2024 · Removing duplicates from a list is a common operation in Python which is useful in scenarios where unique elements are required. Python provides multiple methods to …

  2. How to Find Duplicates in a Python List? - Python Guides

    Mar 4, 2025 · One simple approach to find duplicates in a list is by using the Python built-in count() function. This method iterates through each element in the list and checks if its count is …

  3. Identify duplicate values in a list in Python - Stack Overflow

    That's the simplest way I can think for finding duplicates in a list: my_list = [3, 5, 2, 1, 4, 4, 1] my_list.sort() for i in range(0,len(my_list)-1): if my_list[i] == my_list[i+1]: print str(my_list[i]) + ' is …

  4. python - How do I find the duplicates in a list and create another list

    To compute the list of duplicated elements without libraries: if x in seen: dupes.add(x) else: seen.add(x) or, more concisely: If list elements are not hashable, you cannot use sets/dicts …

  5. Program to print duplicates from a list of integers in Python

    Dec 27, 2024 · In this article, we will explore various methods to print duplicates from a list of integers in Python. The simplest way to do is by using a set. Set in Python only stores unique …

  6. Find Duplicates in a Python List - datagy

    Dec 16, 2021 · How to Find Duplicates in a List in Python. Let’s start this tutorial by covering off how to find duplicates in a list in Python. We can do this by making use of both the set() …

  7. python - Efficiently finding duplicates in a list - Stack Overflow

    Oct 4, 2017 · I have the function below which searches an array for duplicate entries and then returns a list of the duplicates. I'd like to speed this piece of my code up, can anyone suggest …

  8. 5 Best Ways to Find Duplicate Items in a List in Python

    Mar 3, 2024 · Python list comprehensions provide a succinct way to iterate and filter elements. Combined with the set() function, this can identify duplicates by converting the list to a set and …

  9. Finding Duplicates in Python Lists: A Complete Guide

    Nov 3, 2024 · Here are three common approaches to find duplicates in a list: seen = set() duplicates = set() for item in lst: if item in seen: duplicates.add(item) seen.add(item) return...

  10. Finding Duplicates in Python Lists - CodeRivers

    4 days ago · In Python programming, working with lists is a common task. One frequently encountered problem is identifying and handling duplicate elements within a list. Whether you …

Refresh