Method |
Describe |
String.capitalize () |
Returns a copy of the first-letter uppercase string |
String.center (width[, Fillchar]) |
Returns a string with a length of max (len (string), width) and a copy of string within it, using Fillchar on both sides (default = null character) padding |
String.count (sub[, start[, end]]) |
Calculates the number of occurrences of a sub-string sub, limiting the search scope to String[start:end] |
String.decode ([encoding[,errors]]) |
Returns the decoded version of a string using the given encoding, which specifies the error handling method (' strict ', ' ignore ' or ' replace ') |
String.encode ([encoding[, errors]]) |
Returns the encoded version of a string using the given encoding, specified by error (' strict ', ' ignore ' or ' replace ') |
String.endwith (suffix[, Start[,end]]) |
Checks whether the string ends with suffix , using the given index start and end To select a matching range |
String.expandtabs ([tabsize]) |
Returns a copy of the string where the tab character is extended with a space, optionally using the given tabsize(default is 8) |
String.find (sub[, start[, end]]) |
Returns the first index of a sub-character sub and returns -1 if no such index exists . an optional definition of the search scope is String[start:end] |
String.index (sub[, start[, end]]) |
Returns the first index of the substring sub , or throws a valueerror exception when the index is not found , the range of the semantic search is string[start:end] |
String.isalnum () |
Checks whether a string is made up of letters or numeric characters |
String.isalpha () |
Checks whether a string is made up of alphabetic characters |
String.isdigit () |
Checks whether a string is made up of numbers |
String.islower () |
Checks if all instance-based characters (letters) in a string are lowercase |
String.isspace () |
Checks whether the string consists of spaces |
String.istitle () |
Check that the instance-based characters in the string that are not the instance-based letters are uppercase, and that the other instance-based characters are lowercase. |
String.isupper () |
Checks if the instance-based characters in all strings are uppercase |
String.Join (Sequence) |
String that returns the string element in which sequence has been concatenated |
String.ljust (width[, Fillchar]) |
Returns a string with a length of max (len (string), width) and the left-aligned copy of the string , using Fillchar on the right (default = null character) padding |
String.Lower () |
Returns a copy of a string in which all instance-based characters are lowercase |
String.lstrip ([chars]) |
Returns a copy of a string where all chars(the default is a white space character, such as a space,tab , and line break) are removed from the beginning of the string |
String.partition (Sep) |
Search for Sep in the string and return (head, Sep, tail) |
String.Replace (old, New[,max]) |
Returns a copy of the string in which old matches are replaced with new, optionally replacing Max |
String.rfind (sub[, start[, end]]) |
Returns the last index of the position where the sub-string sub was found, or -1 if no such index exists . scope of the search can be defined String[start:end] |
String.rindex |
Returns the last index of the sub-string sub where it was found, and throws a ValueError exception if no such index exists . Can define a search range of String[start:end] |
String.rjust (width[, Fillchar]) |
Returns a string with a length of max (len (string), width) and the right-aligned copy of the string, using Fillchar on the left (default = null character) padding |
String.rpartition (STEP) |
Same as Partition, but search from the right |
String.rstrip ([chars]) |
Returns a copy of a string where all chars ( the default is a white space character, such as a space,tab , and line break) are removed from the end of the string |
String.rsplit ([sep[, Maxsplit]]) |
With split, but is counted from right to left when using Maxsplit |
String.Split ([sep[, Maxsplit]]) |
Returns a list of all the words in the string, using Sep as the delimiter (if the word is not specifically noted as a space-splitting), you can use maxsplit to specify the maximum tangent fraction |
String.splitlines ([keepends]) |
Returns a list of all rows in a string, optionally including line breaks (including if the keepend parameter is provided) |
String.startwith (prefix[, start[, end]]) |
Checks whether a string starts with prefix and can use the given index start and end To define the range of matches |
String.strip ([chars]) |
Returns a copy of the string where all chars (the default is a space ) are stripped from the beginning and end of the string (default to all whitespace characters, such as empty characters,tab and line break) |
String.swapcase () |
Returns a copy of the string, where all instance-based character Nonalphanumeric interchange case |
String.title () |
Returns a copy of a string where the words begin with an uppercase letter |
String.translate (Table[,deletchars]) |
Returns a copy of the string in which all characters are converted using table(constructed by the Maketrans function in the string module ). You can choose to delete All characters that appear in the Delelechars |
String.upper () |
Returns a copy of a string in which all instance-based characters are uppercase |
String.zfill (width) |
fills a width character with 0 on the left side of the string |