String.capitalize ()
The first character of the string is capitalized
String.center (Width,[,fill])
Center of the original character, space padding to width length
String.count (Str,beg=0,end=len (String))
Gets the number of a substring in a string, calculates the number of occurrences, and can specify the range
String.decode (encoding= ' UTF-8 ', errors= ' strict ')
Decode string, error default report ValueError unless errors is ignore or replace
String.encode (encoding= ' UTF-8 ', errors= ' strict ')String.endswith (Suffix,beg=0,end=len (String))
Whether to end with * *
String.expandtabs (tabsize=8)
Turn tab in string to a space, default 8
String.find (Str,beg=0,end=len (STIRNG))
Detects whether a STR is included, there is a return start index, otherwise returns-1
String.index (Str,begin=0,end=len (String))
With find, there is no report exception, ValueError
String.isalnum ()
At least one character, and all characters are letters or numbers, True. Detects if a string contains only 0-9a-za-z
String.isalpha ()
At least one character, all characters are letters, True. Detects if a string contains only letters
String.isdecimal ()
Contains only decimal digits, True
Stirng.isdigit ()
Contains only numbers, True. Detects if a string contains only numbers
String.islower ()
At least one uppercase character and all characters lowercase, True. Detect if the string is both lowercase letters
String.isnumeric ()
Contains only numeric characters, True
String.isspace ()
Contains only spaces, True. Detects whether a string is both a white-space character
String.istitle ()
The caption character, True. Detects whether a word in a string is capitalized in the first letter
String.isupper ()
At least one uppercase and lowercase character and all characters are capitalized, True. Detect if a string is all uppercase
String.Join (seq)
With string as the delimiter, all elements in the SEQ are merged into a new string. Inserts the original string between every two characters in the argument string
String.ljust (width)
Returns an original string left aligned, space added to length width
String.Lower ()
Turn lowercase. Convert all strings to lowercase
String.lstrip ()
Cut off the left space
String.partition (str)
= Find+split, first position from STR, truncated to PRE_STR,STR,AFTER_STR tuple, without str pre_str=strstring.replace (Str1,str2,num=string.count ( STR1)) Replace, specify no more than num times and can be implemented as a template
String.rfind (Str,beg=0,end=len (String))
Same as find, start on the right.
String.rindex (Str,beg=0,end=len (String))
Same as index, start right
String.rjust (width)
Right-justified, space-padded
String.rpartition (str)
Same partition, right start.
String.rstrip ([chars])
Clears the right margin, including newline characters, returning the processed string
String.Split (str= "", Maxsplit =string.count (str))
In str slices, you can specify the number of splits, split the string, return the list, the default delimiter space
String.splitlines (Num=string.count (' \ n '))
S.splitlines ([keepends]) separated by rows to specify the number of splits
String.startswith (Obj,beg=0,end=len (String))
Start with STR, True. Detects whether a string starts with a substring
String.strip ([obj])
Execute Lstrip and Rstrip on string
String.swapcase
Reverses the case in a string. String lowercase uppercase, uppercase to lower case
String.title ()
Title flower, capitalize the first letter of the word, the remaining lowercase
String.translate (str,del= "")
S.translate (table) converts a string character based on Str, and the character to be filtered is placed in the Del parameter
String.upper ()
Turn the capitalization. To capitalize all strings
String.zfill (width)
Returns the length width of the string, the original string right-aligned, front padding 0
Len (String)
Gets the length of the string
Python string API