标签:append python [] 去重 pytho pen lis for end
常规列表去重的两种方法
第一种:
list=[1,2,2,2,2,3,4,5,5,6,7,8,8,9]
list2=[]
for a in list:
if a not in list2:
list2.append(a)
print (list2)
第二种:
list=[1,2,2,2,2,3,4,5,5,6,7,8,8,9]
list=list(set(list))
print (list3)
标签:append python [] 去重 pytho pen lis for end
原文地址:https://www.cnblogs.com/mahaining/p/9434184.html