Python Tutorial

Wednesday, August 18, 2010

python count occurrence of a string

'''
   this code is use for count occurrence of string
'''
data="Life is very very easy with Python"
print data.count("very")
print data.count("Python")



Output:
2
1

0 comments:

Post a Comment