Search
 
SCRIPT & CODE EXAMPLE
 

PYTHON

2 list difference python

list1 = [1, 2, 4]
list2 = [4, 5, 6]

set_difference = set(list1) - set(list2)
list_difference = list(set_difference)

print(list_difference)

#result
[1,2]
Comment

find different between list

a = ['1', '2']
b = ['1', '2', '3', '4']
diff = list(set(a) - set(b))

['3', '4']
Comment

python find difference between lists

s = set(temp2)
temp3 = [x for x in temp1 if x not in s]
Comment

PREVIOUS NEXT
Code Example
Python :: add place in certain index python string 
Python :: isdigit python 
Python :: Python function to compute factorial of a number. 
Python :: exclude last value of an array python 
Python :: real hour in python 
Python :: how to capitalize first letter in python 
Python :: Splitting training and test data using sklearn 
Python :: how to check if item is in the variable python 
Python :: fillna method 
Python :: c++ vs python 
Python :: django response headers 
Python :: turn off warning when import python 
Python :: discord py check if user has permission return message if not 
Python :: python make file executable 
Python :: how to use label encoding in python 
Python :: remove dot from number python 
Python :: picasa 
Python :: how to change frame in tkinter 
Python :: column to int pandas 
Python :: subtract current date from pandas date column 
Python :: Python program to draw hexagon 
Python :: pandas legend placement 
Python :: how to install ffmpeg python heroku 
Python :: how to add new column in csv file using pandas 
Python :: Python NumPy swapaxis Function Example 
Python :: python raise typeerror 
Python :: python sort dict by value 
Python :: how to add percentage in countplot 
Python :: create a superuser to access django admin 
Python :: pandas merge two columns from different dataframes 
ADD CONTENT
Topic
Content
Source link
Name
8+8 =