我有一段代码用这段代码加载了 2 个列表:
with open('blacklists.bls', 'r') as f:
L = [dnsbls.strip() for dnsbls in f]
with open('ignore.bls', 'r') as f2:
L2 = [ignbls.stip() for ignbls in f2]
dnsbls 包含:
list1
list2
list3
ignbls 包含
list2
我想要做的是合并 dnsbls 和 ignbls,然后删除任何出现多次的行并用“for”打印这些行。我在想类似的事情:
for combinedlist in L3:
print combinedlist
在 aboe 示例中将打印出:
list1
list3