Diff 2 lists python

Przykłady kodu

8
0

2 Lista różnic w Pythonie

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

diff 2 lists python

def get_diff(a: list,b: list) -> list:
    return list(set(a) ^ set(b))

Podobne strony

Podobne strony do przykłady

W innych językach

Ta strona jest w innych językach

Русский
..................................................................................................................
English
..................................................................................................................
Italiano
..................................................................................................................
Română
..................................................................................................................
한국어
..................................................................................................................
हिन्दी
..................................................................................................................
Français
..................................................................................................................
Türk
..................................................................................................................
Česk
..................................................................................................................
Português
..................................................................................................................
ไทย
..................................................................................................................
中文
..................................................................................................................
Español
..................................................................................................................
Slovenský
..................................................................................................................
Балгарскі
..................................................................................................................
Íslensk
..................................................................................................................