待补充:https://www.cnblogs.com/zknublx/p/6042295.html 一.使用集合直接去重 ids = [1,4,3,3,4,2,3,4,5,6,1]ids = list(set(ids)) 处理起来比较简单,使用了集合方法set进行处理,不过结果不会保留之前的顺序. 二.列表法 ids = [1,2,3,3,4,2,3,4,5,6,1]news_ids = []for id in ids: if id not in news_ids: new…
#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:/ou…