Given an item, how can I count its occurrences in a list in Python?
How can I count the occurrences of a list item in Python
De openkb
Sommaire |
Questions
Answers
>>> [1, 2, 3, 4, 1, 4, 1].count(1) 3
Source
License : cc by-sa 3.0
http://stackoverflow.com/questions/2600191/how-can-i-count-the-occurrences-of-a-list-item-in-python