Search
 
SCRIPT & CODE EXAMPLE
 
CODE EXAMPLE FOR PYTHON

how to eliminate duplicate values in list python

def dedupe(items):
    seen = set()
    for item in items:
        if item not in seen:
            yield item
            seen.add(item) 

a = [1, 5, 2, 1, 9, 1, 5, 10]
list(dedupe(a))# [1, 5, 2, 9, 10]
Source by stackoverflow.com #
 
PREVIOUS NEXT
Tagged: #eliminate #duplicate #values #list #python
ADD COMMENT
Topic
Name
7+9 =