4. 素朴な実装 3 frequency = defaultdict(int) for line in opened_file: for word in some_splitter(line): frequency[word] += 1 for word in frequency: some_output(word, frequency[word]) ファイル frequency メモリに 辞書/ハッシュ/ 連想配列/Mapを 持つ頻度(Pythonic) frequency = collections.Counter( word for line in opened_file for word in some_splitter(line)) for word, count in frequency.iteritems(): some_output(word, count)