#!/root/bin/python
with open('/etc/passwd','r') as filea:
with open('/tmp/mima','r') as fileb:
s1 = set(filea)
s2 = set(fileb)
s3 = s2 - s1
with open('/tmp/result.txt','w') as filec:
filec.writelines(s3)
python脚本实现文件去重比较本脚本实现两个文件去重后比较得出补集写到新文件中.代码实现如下#!/root/bin/pythonwith open('/etc/passwd','r') as filea: with open('/tmp/mima','r') as fileb: s1 = set(filea) s2 = set(fileb) ...