#coding:utf-8 #author:Blood_Zero import re tmp_list=[] f=open("E:/ASP.txt","r") f1=f.readlines() for i in f1: rule=re.compile('\W') i=re.sub(rule,'',i) tmp_list.append(i) f.close() new_list=list(set(tmp_list)) new_file=open("E:/output.txt","w+") for line in new_list: new_file.write(line) new_file.write("\n") new_file.close()
asp.txt是我们的原文件,output.txt是输出文件;
转载请说明出处!