In Python 2.7, I want to iterate over a collections.Counter instance in descending count order.
collections.Counter
>>> import collections >>> c = co
You can iterate over c.most_common() to get the items in the desired order. See also the documentation of Counter.most_common().
c.most_common()
Example:
>>> c = collections.Counter(a=1, b=999) >>> c.most_common() [('b', 999), ('a', 1)]