lists do not have find-methodbut they have method named indexwhich is quite similar in that it searches for given element in the list and returns its index strings also have method named index that does almost the same thing as find howeverwhile find will return - if the substring does not exist in the stringindex will end with an error message if we want to know if substring is part of string and do not really care about its locationwe can also use in'berlinin strue 'osloin sfalse if 'cin sprint ' foundelseprint 'no cc found this use of in to check for the existence of single element also works for lists and tuples for stringsthe method is slightly more flexiblesince we can check for substring of arbitrary length in many caseswe are interested not only in finding substringbut also in finding it and replace it with something else for this taskwe have string method named replace it takes two strings as argumentsand call such as replace( will replace by everywhere in the string the following examples illustrate how this method is useds 'berlin at pms replace(''__''berlin:__ __c__at__ __pms replace('berlin''bonn''bonn at pms replace( [: find(':')]'bonn''bonn at pmin the final examplewe combine find and replace to replace all the text before the ':with 'bonnfirsts find(':'returns the number sixwhich is the index where the ':is foundthen the slice [: is 'berlin'which is replaced by 'bonnhoweverone important observation in this example is that these repeated calls to replace do not change sbutinsteadeach call returns new string where the substrings have been replaced as requested splitting and joining strings we have already introduced the split methodwhich is arguably the most useful method for reading and processing text files as we recall from the call split(sepwill split the string into list of substrings separated by sep the sep argument is optionaland if it is omitted the string is split with respect to whitespace consider these two simple examples to recall how split is used