python set 集合 方法实现 去重
# 集合 set 不可重复列表 mylist = ['A','B','C','A','B','D'] mylist2 = [] mylist3 = [] #去重 for item in set(mylist): mylist2.append(item) # 排序 + 去重 for item in sorted(set(mylist)): mylist3.append(item) print(mylist) print(mylist2) print(mylist3)