weakish weakish - 1 year ago 80
Python Question

How can I count the occurrences of a list item in Python?

Given an item, how can I count its occurrences in a list in Python?

Answer Source
>>> [1, 2, 3, 4, 1, 4, 1].count(1)
3
Recommended from our users: Dynamic Network Monitoring from WhatsUp Gold from IPSwitch. Free Download