Steve R. Hastings wrote:

> Here is a function called "tally()".  It reduces a list to a dictionary
> of counts, with one key for each value from the list.  The value for
> each key is the count of how many times it appeared in the list.
>
 >
> def tally(seq, d=None):
>     if d == None:
>         d = {}
> 
>     for x in seq:
>         if x in d:
>             d[x] += 1
>         else:
>             d[x] = 1
>     return d
> 
> 
> This neatly replaces truecount(), and you can use it for other things as
> well.

     if True in talley(S): do_somthing()

Works for me...  ;-)


Cheers,
   Ron




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

Reply via email to