- 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.
- It consists of the 3 parameters.
- value: The value that the string starts with.
- start: The position to start the search of string.
- end: The position to end the search.
#write a python program to demonstrate the startswith method.
- str="welcome to python"
- str=str.startswith("w",0,14)
- print(str)
Output:true
No comments