You could try a collections.defaultdict object with an integer as the startup 
value:

counts = collections.defaultdict(int)
for thing in long_list:
  counts[get_last_two_digits(thing)] += 1

This assumes get_last_two_digits is the function that provides the key you want 
to count by. I'm not sure what you want get_last_two_digits to look like from 
your post, or how you would get the long_list, which is just an iterator 
through your records.

Josh 
-- 
http://mail.python.org/mailman/listinfo/python-list

Reply via email to