ドキュメントのサンプルを使用しました:
>>> Counter('abracadabra').most_common(3)
[('a', 5), ('r', 2), ('b', 2)]
結果を次のようにするにはどうすればよいですか。
{ 'a': 5, 'r' :2 , 'b' :2}
Counter().most_common()
コードを保持したいとしますか?
ドキュメントのサンプルを使用しました:
>>> Counter('abracadabra').most_common(3)
[('a', 5), ('r', 2), ('b', 2)]
結果を次のようにするにはどうすればよいですか。
{ 'a': 5, 'r' :2 , 'b' :2}
Counter().most_common()
コードを保持したいとしますか?