•  In python, we have another built-in method called startswith.
  • startswith is used to check whether the string startswith this specified string.
  • It returns the boolean type.
  • If the string startswith gave specified string then it returns true else false.
Syntax: str.startswith(value,start,end)

  • It consists of the 3 parameters.
  1. value:  The value that the string starts with.
  2. start:    The position to start the search of string.
  3. end:  The position to end the search.

#write a python program to demonstrate the startswith method.

  1. str="welcome to python"
  2. str=str.startswith("w",0,14)
  3. print(str)
Output:true

Instance Of Java

We will help you in learning.Please leave your comments and suggestions in comment section. if you any doubts please use search box provided right side. Search there for answers thank you.
«
Next
Newer Post
»
Previous
Older Post

No comments

Leave a Reply

Select Menu