问题在于您正在将中的每一行与
fileone中的同一行进行比较
filetwo。只要一个文件中有多余的一行,您就会发现这些行再也不相等了。尝试这个:
with open('old.csv', 'r') as t1, open('new.csv', 'r') as t2: fileone = t1.readlines() filetwo = t2.readlines()with open('update.csv', 'w') as outFile: for line in filetwo: if line not in fileone: outFile.write(line)
欢迎分享,转载请注明来源:内存溢出
评论列表(0条)