假设你的文件名是a.txt,写到b.txt
d = {}
for line in open('a.txt'):
d[line] = d.get(line, 0) + 1
fd = open('b.txt', 'w')
for k, v in d.items():
if v > 1:
fd.write(k)
fd.close()
假设你的文件名是a.txt,写到b.txt
d = {}
for line in open('a.txt'):
d[line] = d.get(line, 0) + 1
fd = open('b.txt', 'w')
for k, v in d.items():
if v > 1:
fd.write(k)
fd.close()