python 集合运算

x = set()
y = set()

with open('note.txt', 'r') as f:
    lines = f.readlines()
    for line in lines:
        x.add(line)

with open('note1.txt', 'r') as f:
    lines = f.readlines()
    for line in lines:
        y.add(line)
c = x & y
print(x-c)
print(y-c)
# print(y)
posted @ 2021-12-30 15:36  耀耀王  阅读(58)  评论(0编辑  收藏  举报