1. judge whether the string 'str' is null. Approach 1: If the string length is 0, the string is empty. The code is as follows: isNull = (len (str) = 0) 2. take the substring str = "abcdef" str2 = str [index1: index2] str2 is a continuous substring from the subscript index1 to the end of the index2-1. // Forward the following functions first, all lower-case source values (): str. lower () case-insensitive swap: str. swapcase () has upper-case letters and other lower-case letters: str. capital: str. title () 2. Remove space from the string and remove space from both sides of the specified character: str. strip () left space: str. remove right space from lstrip (): str. rstrip () removes the strings on both sides: str. strip ('D'), corresponding also has lstrip, rstrip 3, split string by specified character as list str. split ('#') 4. Check whether the string starts with start: str. whether startswith ('start') ends with end: str. endswith ('end') is all letters or numbers: str. isalnum (): str. isalpha (): str. whether isdigit () is all lowercase: str. whether islower () is in uppercase: str. isupper () 5. Replace string with old with new: str. replace ('Old', 'new') replaces the old with new: str. replace ('Old', 'new', maxReplaceTimes) 6. Specify a string for string search.-1: str is not returned. find ('T') specified start position search: str. find ('T', start) specifies the start position and end position for search: str. find ('T', start, end) from the right to find: str. how many specified strings are searched by rfind ('T'): str. all methods above count ('T') can be replaced by indexes. The difference is that if index cannot be found, an exception will be thrown, while find returns-1 7. Get a fixed length for character formatting, right alignment, insufficient space on the left to fill in: str. fill ust (width) to get a fixed length, align left, and fill in str with spaces on the right. ljust (width) gets a fixed length and is aligned in the middle. The two sides are not filled with spaces: str. center (width) gets a fixed length, right alignment, left is less than 0 fill: str. zfill (width)