Python基础-List找重复数

请从L=[1,10,20,50,20,20,1]中找出重复数。

 1 L=[1,10,20,50,20,20,1]
 2 L1=[]
 3 for i in L:
 4     if(L.count(i)>1):
 5         L1.append(i)
 6 L2=[]
 7 for i in L1:
 8     if i not in L2:
 9         L2.append(i)
10 print L2
原文地址:https://www.cnblogs.com/Python-XiaCaiP/p/8521517.html