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

    Nov 27, 2024 · Finding duplicates in a list is a common task in programming. In Python, there are several ways to do this. Let’s explore the efficient methods to find duplicates. Using a Set …

  2. 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 …

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

    Mar 4, 2025 · Learn how to find duplicates in a Python list using loops, `collections.Counter()`, and `set()`. This guide includes step-by-step examples for easy understanding. Skip to content

  4. 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() …

  5. How to Find Duplicates in a List Python

    Oct 28, 2023 · Python’s built-in functions make it easy to find duplicates in a list. The technique uses the set() function which automatically removes duplicates, then converts the result back …

  6. How To Check For Duplicates in a Python List - Codefather

    Apr 17, 2021 · There are several approaches to check for duplicates in a Python list. Converting a list to a set allows to find out if the list contains duplicates by comparing the size of the list with …

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

    Mar 3, 2024 · 💡 Problem Formulation: When working with lists in Python, a common task is to identify duplicate items. For example, given a list ['apple', 'banana', 'cherry', 'apple', 'cherry'], …

  8. Check If a List Has Duplicates in Python | note.nkmk.me - nkmk …

    May 15, 2023 · Use set() if a list does not contain unhashable objects like other lists. When a list is passed to set(), it returns a set, which ignores duplicates and keeps only unique elements. …

  9. Check If a List has Duplicate Elements - PythonForBeginners.com

    Sep 2, 2021 · In this article, we will look at different ways to check if a list has duplicate elements in it. We know that sets in Python contain only unique elements. We can use this property of …

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

    I guess the most effective way to find duplicates in a list is: from collections import Counter def duplicates(values): dups = Counter(values) - Counter(set(values)) return list(dups.keys()) …

  11. Some results have been removed