String Manipulation <
A number, a string, a tuple is an immutable type, that is, the result of the operation is the return value, the source string does not change
mystr = "Hello world! Everybody "
Mystr.find ("Eve") gets the result 13, which is the substring at the beginning of the main string, looking from left to right.
Mystr.rfind ("Eve") looks from right to left.
Find (), RFind (), found to return subscript, no return-1 found. Index () did not find the return exception.
------------------------------------------------------------------------------------------------------
COUNT () returns the number of occurrences of the substring.
Mystr.count (substr, start, end) MyStr the entire string by default.
Mystr.replace (STR1, STR2, num) replaces str1 with STR2, and Num represents the number of replacements.
------------------------------------------------------------------------------------------------------
Split (str, maxsize) cuts a string based on STR and can specify the number of times. The default is to remove the space \ t \ n and other escape characters.
Cuts a string into a tuple.
------------------------------------------------------------------------------------------------------
Title () can capitalize each word in the first letter
Capitalize () capitalize the first letter of the initial word
-----------------------------------------------------------------------------------------------------
EndsWith (obj) can check if the suffix of the file name is obj, which returns true, otherwise false.
StartsWith (obj) checks whether to start with obj.
-----------------------------------------------------------------------------------------------------
Lower () changes the character of the string to lowercase.
Upper () capitalizes the character of the string.
The text that can be used to detect user input.
------------------------------------------------------------------------------------------------------
Center (width) centered, ljust (width) on the left, Rjust (width) on the right, the rest filled with spaces, the total length is width.
Lstrip () Removes the left white space character, Rstrip () removes the right white space character, and strip () deletes both whitespace characters.
Partition (str) divides a string into three parts based on Str.
The Splitlines () is cut according to \ n-NewLine.
------------------------------------------------------------------------------------------------------
Isalpha () judgment is not a pure character.
IsDigit () judgment is not a pure number.
Isalnum () Determines whether numbers are composed of characters.
Isspace () is not only contains spaces.
------------------------------------------------------------------------------------------------------
str = ' = '
MyStr = [' aaa ', ' BBB ', ' CCC ']
Str.join (MYSTR)
Get the result ' aaa=bbb=c ', that is, using STR to concatenate into a string. List composition string
>
string manipulation of Python