I have to count the word frequency in a text using python. I thought of keeping words in a dictionary and having a count for each of these words.
Now if I have to so
>>> d = {'a': 3, 'b': 1, 'c': 2, 'd': 5, 'e': 0} >>> l = d.items() >>> l.sort(key = lambda item: item[1]) >>> l [('e', 0), ('b', 1), ('c', 2), ('a', 3), ('d', 5)]