problem with count in 2.48 ?

Count ()
i tried this on a var but get that count is not recognise!

is there a special module top be loaded to have acces to this command?

Thanks

I’m sorry, I don’t know what you mean.

Most time I use “len” function to know how many items has an array var, but I’m not sure wheater it is what you want or not.


x = [0, 1, 2]
print(len(x)) # result 3  
for i in range(len(x)):  # from 0 to 2
    print(x[i])

ok i found the problem
now it’s working fine
it can extract the number of time a string in inside another string

Thanks

i think is part of the string functions

like the numbers of times characters / words appear in a string

thats where this count comes into play
but it’s refusing to work like not being recognise

count(sch) : compte le nombre de sous-chaînes sch dans la chaîne :
>>> ch1 = “Le héron au long bec emmanché d’un long cou”
>>> ch2 = ‘long’
>>> print ch1.count(ch2)

Thanks