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

find substring python

 find substring():

  • The find substring is used to find the substring from the string.
  • Substring is the piece of characters from the string.
  • If the string consists of the given string then it returns the index number of the substring. 
  • The string must be enclosed with single or double-quotes.
  • It returns -1 if the substring does not found instead of an error.
  • find() has 3 parameters,they are:
  1. value: The value to be search
  2. start:  from where to search
  3. end:  from where to stop searching.
Syntax: str.find(value,start,end)

#write a python code to demonstrate the find substring function.

Output: 5
              -1









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

Share the post

find substring python

×

Subscribe to Java Tutorial - Instanceofjava

Get updates delivered right to your inbox!

Thank you for your subscription

×