Hi, just as a side-note
On Wed, Dec 19, 2012 at 02:45:13AM -0800, dgcosgr...@gmail.com wrote: > for word in list: > if word in dict: > count = dict[word] > count += 1 > dict[word] = count > else: > dict[word] = 1 When you got the indentation and names right, you can restate this as import collections counter = collections.Counter(words) in Python 2.7 or as import collections counter = collections.defaultdict(int) for word in words: counter[word] += 1 in Python 2.6 Regards, Thomas. -- http://mail.python.org/mailman/listinfo/python-list