Search
 
SCRIPT & CODE EXAMPLE
 
CODE EXAMPLE FOR PYTHON

Python String count() Implementation of the count() method using optional parameters

# Python program to demonstrate the use of
# count() method without optional parameters 
  
# string in which occurrence will be checked
string = "Hello Welcome to Softhunt.net We Welcome you" 
  
# counts the number of times substring occurs in 
# the given string between index 0 and 5 and returns 
# an integer
print(string.count("Welcome", 0, 5))
  
print(string.count("Welcome", 0, 15))
Source by softhunt.net #
 
PREVIOUS NEXT
Tagged: #Python #String #Implementation #method #optional #parameters
ADD COMMENT
Topic
Name
9+2 =