1. String formatting: % is used. Put the string to be formatted on the left side of %, and put the value to be formatted on the right side. If you want to format multiple values, the delimiter uses tuples or dictionaries. However, the list or other sequences cannot be used because the sequence is interpreted as a value. Only tuples and dictionaries can format more than one value. To include a percent sign in a string, you must use %. If the tuples to be converted exist as part of the conversion expression, they must be enclosed in parentheses: >>> '% s plus % s equals % s' % (, 2) ==> '1 plus 1 equals 2 '.
2. String method: (1) find method: search for a substring in a long string and return the leftmost index of the position of the substring. If not found,-1 is returned. You can also provide the second and third parameters of the find method to indicate the start and end points of the search (including the first index, excluding the second index ). Www.2cto.com
(2) join method: inverse method of the split method. It is used to add elements to the queue. The connector is in front, and the queue to be connected is the parameter of the join method. All queue elements to be added must be strings.
(3) lower method: return the lower case of the string.
(4) title method: uppercase letters and lowercase letters.
(5) replace method: returns the string obtained after all matching items of a string are replaced.
(6) split method: the inverse join method, which is used to split strings into sequences. If no separator is provided, all spaces (spaces, tabulation, line breaks, etc.) are used as separators.
(7) strip Method: returns a string that removes spaces on both sides (excluding internal spaces. You can also specify characters to be removed and column them as parameters.
(8) translate method: some parts of the string can be replaced, but this method only processes a single character and can be replaced at the same time.
Author uohzoaix