On 19/12/12 5:12 PM, Mitya Sirenef wrote:
> You can also do:
>
> count = sum(i==digit for i in number)
>
> I think this is very clear and short..

Another...

import re
count = len(re.findall(digit, number))

-- 
shantanoo
_______________________________________________
Tutor maillist  -  Tutor@python.org
To unsubscribe or change subscription options:
http://mail.python.org/mailman/listinfo/tutor

Reply via email to