标签:
我的解决方式:
1 def checkio(data): 2 alist = [] 3 for i in data: 4 if (data.count(i) >1 ): 5 alist.append(i) 6 7 return alist
推荐的解决方式:
checkio=lambda d:[x for x in d if d.count(x)>1]
还有就是:
1 def checkio(data): 2 return [i for i in data if data.count(i) > 1]
标签:
原文地址:http://www.cnblogs.com/canxuexiecheng/p/4410255.html