locating value in string there are times when you need to locate specific information in string for exampleyou may want to know whether string contains the word hello in it one of the essential purposes behind creating and maintaining data is to be able to search it later to locate specific bits of information strings are no different -they're most useful when you can find what you need quickly and without any problems python provides number of functions for searching strings here are the most commonly used functionscount(strbeg end=len(string))counts how many times str occurs in string you can limit the search by specifying beginning index using beg or an ending index using end endswith(suffixbeg= end=len(string))returns true when string ends with the characters specified by suffix you can limit the check by specifying beginning index using beg or an ending index using end find(strbeg= end=len(string))determines whether str occurs in string and outputs the index of the location you can limit the search by specifying beginning index using beg or ending index using end index(strbeg= end=len(string))provides the same functionality as find()but raises an exception when str isn' found replace(oldnew [max])replaces all occurrences of the character sequence specified by old in string with the character sequence specified by new you can limit the number of replacements by specifying value for max rfind(strbeg= end=len(string))provides the same functionality as find()but searches backward from the end of the string instead of the beginning rindex(strbeg= end=len(string))provides the same functionality as index()but searches backward from the end of the string instead of the beginning startswith(prefixbeg= end=len(string))returns true when string begins with the characters specified by prefix you can limit the check by specifying beginning index using beg or an ending index using end finding the data that you need is an essential programming task -one that is required no matter what kind of application you create the following steps help you create an example that demonstrates the use of search functionality within strings this example also appears with the downloadable source code as searchstring py