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
时间: 2024-10-13 11:06:34
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