📜  python合并列表没有重复 - Python代码示例

📅  最后修改于: 2022-03-11 14:45:09.432000             🧑  作者: Mango

代码示例1
# Create the two lists
l1 = [1, 2, 2, 4]
l2 = [2, 5, 5, 5, 6]
# Find elements that are in second but not in first
new = set(l2) - set(l1)
# Create the new list using list concatenation
l = l1 + list(new)