Searching the pattern in a String using find and index

try:
    s="brown box red pencil brown pen red pen red box"
    print s.find("red")
    print s.find("red",13,len(s))
    print s.find("red",34,len(s))
    print s.find("crow")
    print s.index("red")
    print s.index("red",13,len(s))
    print s.index("red",34,len(s))
    print s.index("crow")
except ValueError:
   print "crow not a pattern in string"
   

10 comments:

SATHYA TECH said...

thank you for offering such a unique content.we are very happy to share your blog this is one of the recommanded site in python.very useful python professionals and students

Python training in hyderabad
Python training in ameerpet
best Python training in india

anebelly said...

Thank you for sharing your article with us and it's terribly helpful for Beginners. This website is informative web log and that i feel very lucky to read your Blog and keep share your articles and keep occurring.
python training in hyderabad

zara said...

very useful for python professionals and students
Python Training in Hyderabad

mytrainingsonline said...


Nice blog..! I really loved reading through this article... Thanks for sharing such an amazing post with us and keep blogging...
python online training
Best python online training
python online training in Hyderabad
python online training in india

Digitalkavya said...

Great Article. Thanks for sharing info.

SAP ABAP Training in Hyderabad

SAP FICO Training in Hyderabad

AWS Training in Hyderabad

Salesforce Training in Hyderabad

Selenium Training in Hyderabad

Pranavi said...

Great Article. Thanks for sharing info.


Workday Training in Hyderabad

IELTS Coaching in Hyderabad

Salesforce Training in Hyderabad

SAP FICO Training in Hyderabad

Digital sabil said...

Great Article. Thanks for sharing info.


Digital Marketing Training in Hyderabad

Best SAP ABAP Training Institute In Ameerpet

Best SAP FICO Training Institute In Ameerpet

Best faculty for AWS Training in Hyderabad

Salesforce Training Institute in Hyderabad

ravindrareddy said...

Great Article. Thanks for sharing info.


Digital Marketing Course in Hyderabad

Digital Marketing Training in Hyderabad

AWS Training in Hyderabad

SEO Training in Hyderabad

Google Analytics Training in Hyderabad

Muralidhara Raju Indukuri said...

Good info.
aws training in hyderabad

meritstep Technology said...

Thanks for Sharing This Article.It is very so much valuable content. I hope these Commenting lists will help to my website
workday studio online training
best workday studio online training
top workday studio online training