data types count(" " = [ :count(" " count(" " - = [ :- count(" "as we can seethe string methods that accept start and end indexes operate on the slice of the string specified by those indexes now we will look at another equivalencethis time to help clarify the behavior of str partition()--although we'll actually use str rpartition(exampleresult rpartition("/" rfind("/"if =- result """" elseresult [: ] [ ] [ :the leftand right-hand code snippets are not quite equivalent because the one on the right also creates new variablei notice that we can assign tuples without formalityand that in both cases we looked for the rightmost occurrence of if is the string "/usr/local/bin/firefox"both snippets produce the same result('/usr/local/bin''/''firefox'we can use str endswith((and str startswith()with single string argumentfor examples startswith("from:")or with tuple of strings here is statement that uses both str endswith(and str lower(to print filename if it is jpeg fileif filename lower(endswith((jpg"jpeg"))print(filename"is jpeg image"the is*(methods such as isalpha(and isspace(return true if the string they are called on has at least one characterand every character in the string meets the criterion for example" isdigit()"isdigit()"- isdigit()" isdigit((falsefalsefalsetruethe is*(methods work on the basis of unicode character classificationsso for examplecalling str isdigit(on the strings "\ {circled digit two} and " returns true for both of them for this reason we cannot assume that string can be converted to an integer when isdigit(returns true when we receive strings from external sources (other programsfilesnetwork connectionsand especially interactive users)the strings may have unwanted leading and trailing whitespace we can strip whitespace from the left using str lstrip()from the right using str rstrip()or from both ends using str strip(we can also give string as an argument to the strip methodsin which case every occurrence of every character given will be stripped from the appropriate end or ends for example