On May 7, 1:31 pm, "Ian Kelly" <[EMAIL PROTECTED]> wrote:
> On Wed, May 7, 2008 at 11:30 AM, Paul Melis <[EMAIL PROTECTED]> wrote:
> > dic = {}
> > for letter in strng:
> > if letter not in dic:
> > dic[letter] = 0
> > dic[letter] += 1
>
> As a further refinement, you could use the defaultdict class from the
> collections module:
>
> dic = defaultdict(int)
> for letter in strng:
> dic[letter] += 1Sounds like novel flow of control. -- http://mail.python.org/mailman/listinfo/python-list
