Get Even More Visitors To Your Blog, Upgrade To A Business Listing >>

startswith python

  •  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



This post first appeared on Java Tutorial - InstanceOfJava, please read the originial post: here

Share the post

startswith python

×

Subscribe to Java Tutorial - Instanceofjava

Get updates delivered right to your inbox!

Thank you for your subscription

×