python如何找到列表中出现最频繁的数

找到列表中出现最频繁的数

test= [1,2,3,4,2,2,3,1,4,4,4]
print(max(set(test),key=test.count))
#-> 4

python有哪些常用库

python常用的库:1.requesuts;2.scrapy;3.pillow;4.twisted;5.numpy;6.matplotlib;7.pygama;8.ipyhton等。

以上就是python如何找到列表中出现最频繁的数的详细内容,更多请关注www.sxiaw.com其它相关文章!