Willian and Psidom already mentioned count,
I just wanted to add that in python the string is also iterative, so list comprehension can also be implemented:
n = len([c for c in ','+text if c==','])
or
n = sum(1 for c in ','+text if c==',')
source
share