+
95
-

python如何从数组中找出重复的数?

python如何从数组中找出重复的数?

比如数组1,2,3,4,1,2,3,44,55 如何找出重复的数字?

网友回复

+
15
-

三种方式

第一

#!/usr/local/python3/bin/python3
# -*- coding: utf-8 -*
mylist = [1,2,2,2,2,3,3,3,4,4,4,4]
myset = set(mylist)
for item in myset:
  print("数字 %d has found %d次数" %(...

点击查看剩余70%

我知道答案,我要回答