リストの中で最も出現回数の多い要素を取り出す[collection.Counter]

elems = ["a", "a", "a", "b", "b", "c"]
c = collections.Counter(elems)
l = list(c.keys())
selected = l[0]
print(selected)
>> a

Python

Posted by vastee