Search
 
SCRIPT & CODE EXAMPLE
 
CODE EXAMPLE FOR PYTHON

python merge list no duplicates

# Create the two lists
l1 = [1, 2, 2, 4]
l2 = [2, 5, 5, 5, 6]
# Find elements that are in second but not in first
new = set(l2) - set(l1)
# Create the new list using list concatenation
l = l1 + list(new)
Source by stackoverflow.com #
 
PREVIOUS NEXT
Tagged: #python #merge #list #duplicates
ADD COMMENT
Topic
Name
2+5 =