[BioPython] Count

Greg Singer singerg at tcd.ie
Thu May 6 13:27:11 EDT 2004


Count became a string method back around Python 2.0 if I recall correctly.
Before that, you had to import it from the string module. You can still do that
for backwards compatibility:

from string import count
print count('aaabbbccc','c')

 - Greg

Quoting Iddo Friedberg <idoerg at burnham.org>:

> I guess the Pasteur Institute pages need updating, count() is a sequence 
> method, not a function. Thus instead of:
> 
>  >>> count(se, 'g')
> 
> 
> use:
> 
>  >>> se.count('g')
> 
> 
> Iddo
> 



More information about the BioPython mailing list