Search
 
SCRIPT & CODE EXAMPLE
 

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]
Comment

PREVIOUS NEXT
Code Example
Python :: iterate over classes in module python 
Python :: python fstring 
Python :: reverse element in a list in python 3 
Python :: python make string one line 
Python :: how to convert adjacency list to adjacency matrix 
Python :: how to install ffmpeg python heroku 
Python :: How to select parts of a numpy array 
Python :: Mittelwert python 
Python :: kill and run process in windows python 
Python :: seaborn iris dataset 
Python :: How to combine train and Test dataset in python 
Python :: remove space characters from string in python 
Python :: view all columns pandas 
Python :: default orange and blue matplotlib 
Python :: font in tkinter 
Python :: how to make a checksum to a file python 
Python :: heroku django procfile 
Python :: extract nonzero array elements python 
Python :: file manage py line 17 from exc django 
Python :: python use functions from another file 
Python :: turn characters to alpgabetic numper python 
Python :: discord.py get server id 
Python :: oversampling using smote 
Python :: transformer un dictionnaire en liste python 
Python :: fibonacci series using recursion in python 
Python :: get function in dictionary 
Python :: map example in python 
Python :: python read video frames 
Python :: python copy a dictionary to a new variable 
Python :: pip not downlaoding cryptography wheel macos 
ADD CONTENT
Topic
Content
Source link
Name
1+9 =