代码如下: import shutil readPath='E:/word4.txt' #要处理的文件 writePath='E:/word5.txt' #要写入的文件 lines_seen=set() outfiile=open(writePath,'a+',encoding='utf-8') f=open(readPath,'r',encoding='utf-8') for line in f: if line not in lines_seen: outfiile.write(line)…