Python基础-List找重复数
生活随笔
收集整理的這篇文章主要介紹了
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
總結
以上是生活随笔為你收集整理的Python基础-List找重复数的全部內容,希望文章能夠幫你解決所遇到的問題。
- 上一篇: 【洛谷P1967】[NOIP2013]货
- 下一篇: sh 脚本执行sql文件传参数