Search
 
SCRIPT & CODE EXAMPLE
 
CODE EXAMPLE FOR PYTHON

list exclude list

a = [1,2]
b = [2,3]
-----------------------------------------------
# single line
excluded = list(set(a) - set(b))

>>> excluded
[1]

-----------------------------------------------
# Or define function:
def set_approach(a, b):
    return list(set(a) - set(b))

>>> set_approach(a, b)
[1]
Source by stackoverflow.com #
 
PREVIOUS NEXT
Tagged: #list #exclude #list
ADD COMMENT
Topic
Name
6+4 =