Skip to content

Instantly share code, notes, and snippets.

@kk6
Created May 31, 2011 04:46
Show Gist options
  • Save kk6/999878 to your computer and use it in GitHub Desktop.
Save kk6/999878 to your computer and use it in GitHub Desktop.
# coding:utf-8
# ANS-progのurl:http://answer.pythonpath.jp/questions/248/
# 「よく使う/全然使わない標準モジュールはなんですか?」
# で名前の上がっているよく使われている標準モジュールTOP10
# 今は数が少ないので手計算でもいいけどCounter使ってみたかったので。
import collections
with open('commonly-used-modulelist.txt', 'r') as load_file:
items = [item.strip('\n') for item in load_file.readlines()]
c = collections.Counter(items)
for i in c.most_common(10):
print("{0:<30}:{1:>3}".format(i[0], i[1]))
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment