1. lower (): converts all uppercase letters into lowercase letters. For example:
Copy codeThe Code is as follows:
Name = 'G'
B = name. lower ()
2. title ": converts a string into a title, that is, the first letter of all words in upper case, and the other letters in lower case. Same as lower ()
3. replace: returns the string obtained after all matching items of a string are replaced.
Copy codeThe Code is as follows:
'This is a test'. replace ('is ', 'are ')
4. split: splits strings into sequences.
Copy codeThe Code is as follows:
'1 + 2 + 3 + 4 + 5'. split ('+ ')
By default, all spaces are used as separators.
V. strip: returns a string that removes spaces on both sides (excluding the interior ).
Copy codeThe Code is as follows:
'In wh is kepy'. strip ()
6. translate: replace some parts of the string. The translate knowledge processes a single character. However, multiple replicas can be performed simultaneously. Multiple Replicas can replace a with B at the same time, and c with d. replace can only replace a with B at a time. The usage of translate is complex. If you need to use it, please refer to the documents that detail it.