标签:amp 交集 -- summary end set集合 集合 extend xtend
list1 = [1, 2, 3, 4, 4, 4, 4, 4, 4, 5, 5, 5]
list2 = [5, 5, 6, 7, 8, 9]
print(list(set(list1) - set(list2)))
print(list(set(list2) - set(list1)))
print(list(set(list1) ^ set(list2)))
print(list(set(list1) | set(list2)))
print(list(set(list1) & set(list2)))
print([i for i in list1 if i not in list2])
print([i for i in list2 if i not in list1])
print([i for i in list1 if i in list2])
summary_list = []
summary_list.extend(list1)
summary_list.extend(list2)
print([i for i in summary_list if i not in set(list1) & set(list2)])
标签:amp 交集 -- summary end set集合 集合 extend xtend
原文地址:https://www.cnblogs.com/hui-code/p/13206021.html