Return list of words ordered by occurrence on Python

Viewed 32
from collections import Counter

list = ['apple', 'egg', 'milk', 'apple', 'milk', 'cereal', 'apple']

result = Counter(list)
print(result)

Output looks like this:

Counter({'apple': 3, 'milk': 2, 'egg': 1, 'cereal': 1})

And I need it to look like this:

apple
milk
egg
cereal
0 Answers
Related