📜  列表 python 代码示例中的 nb_occurence

📅  最后修改于: 2022-03-11 14:46:14.137000             🧑  作者: Mango

代码示例1
>>> import random
>>> l = [random.randint(0,5) for i in range(10)]
>>> l
[1, 3, 0, 0, 5, 1, 0, 0, 0, 4]
>>> l.count(1)
2
>>> l.count(0)
5
>>> l.count(6)
0