Answers for "python get list elements missing in one list"

0

python get list elements missing in one list

list1 = ['1.1.1.1/24', '2.2.2.2/24', '3.3.3.3/24', '4.4.4.4/24']
list2 = ['3.3.3.3/24', '4.4.4.4/24', '5.5.5.5/24', '6.6.6.6/24']

set1 = set(list1)
set2 = set(list2)

missing = list(sorted(set1 - set2))
added = list(sorted(set2 - set1))

print('missing:', missing)
print('added:', added)
Posted by: Guest on January-13-2021

Code answers related to "python get list elements missing in one list"

Code answers related to "TypeScript"

Browse Popular Code Answers by Language