列表去重
listA = [2,2,5,5,45,3,1,3] listB = [2,2,5,5,45,3,1,3] listC = [2,2,5,5,45,3,1,3] #法一:set print(list(set(listA))) #法二 tmp = [] for i in listB: if i not in tmp: tmp.append(i) print(tmp) #法三 tupleA ={}.fromkeys(listC) tmp = [] for i in tupleA: tmp.append(i) print(tmp)
posted on 2020-04-25 17:10 __director 阅读(60) 评论(0) 编辑 收藏 举报