# cp /etc/passwd .
# cp /etc/passwd mima
# vim mima -> 修改,与passwd有些区别
with open('passwd') as fobj:
aset = set(fobj)
with open('mima') as fobj:
bset = set(fobj)
with open('diff.txt', 'w') as fobj:
fobj.writelines(bset - aset)
# cp /etc/passwd .
# cp /etc/passwd mima
# vim mima -> 修改,与passwd有些区别
with open('passwd') as fobj:
aset = set(fobj)
with open('mima') as fobj:
bset = set(fobj)
with open('diff.txt', 'w') as fobj:
fobj.writelines(bset - aset)
本文标题:53-集合实例:取出第二个文件有,第一个文件没有的行
本文链接:https://www.haomeiwen.com/subject/ysclvftx.html
网友评论