Edited at

collections.Counterを用いてlistのカウントアップ

More than 5 years have passed since last update.

a = ["poko", "poko", "hoge", "aaa", "aaa", "poko", "aaa", "aab"]

のようなlistがある

from collections import Counter

counts = Counter(a)
#上位2番目
print counts.most_common(2)
# [Out]: [('poko', 3), ('aaa', 3)]

#上位から全部
print counts.most_common()
# [Out]: [('poko', 3), ('aaa', 3), ('aab', 1), ('hoge', 1)]

# key指定
print counts[“poko”]
# [Out]: 3

sort済みのdict(みたいな言い方で良いのか?)っぽくつかえる