Tech notes

Daily notes about my IT activities.

2012-04-04

python: count items with specified values in list

by hackprime

>>> a = [1, 2, 3, 4, 1, 5]
>>> a.count(1)
2
>>> a.count(2)
1