name="My \ t name is {name} and the age was {age}"
Print (Name.capitalize ()) # capitalize the first letter of the value of name
Print (Name.count ("a")) # output a The number of occurrences of this character
Print (Name.center,"-") # Prints 50, others-instead
Print (Name.endswith ("ex")) # End contains ex
Print (Name.expandtabs (tabsize=30)) # converts \ t in a string to 30 spaces
Print (Name[name.find ("name"):]) #find Find the meaning string can also be sliced, the result returned is the name and the following line of content
Print (Name.format (name="Wang", age=23))
Print (Name.format_map ({"Name":"Wang","Age": 23}))#the format of the dictionary: Same as the result of format
Print"ab123". Isalnum ())#determines whether letters and numbers are included and returns True if included
Print"ab124". Isalpha ())#determines whether a plain English character is included and returns True if it is, case insensitive
Print"122". IsDigit ())#determines whether it is an integer and returns true if it is an integer
Print"Al1". Isidentifier ())#The judgment is not a valid identifier (that is, it is a valid variable name)
Print"All". Islower ())#Judgment is not lowercase, yes returns true
Print"All". IsNumeric ())#Judging is not a number, is the return true
Print"All". Isspace ())#Judging is not a space
Print"My Name is". Istitle ())#to determine the first letter of each string, the word is true
Print"My name is". Isupper ())#determine if it is uppercase
Print' + '. Join ([' 1 ',' 2 ',' 3 ']))#converts the value of a list to a string form this output is: 1+2+3
Print (Name.ljust (50,"*"))
Print (Name.rjust ("*"))
Print"WANG". Lower ())#turn uppercase to lowercase
Print"Wang". Upper ())#capitalize a lowercase border town
Print"\ nWang ". Lstrip ())#Cancel the left space and enter
Print"Wang1\ n". Rstrip ())#Remove the right space and enter
Print" \ nabng\ n". Strip ())#remove both left and right spaces and carriage returns.
Print"Wang Han". replace (' A ',' A ', 1))#Replace A in a string with an uppercase A, replacing only one of them
Print' Wang Wang '. RFind (' A '))#Find the subscript of the rightmost character
Print' 1+2+3+4 '. Split (' + '))#format the output as a list with the + sign as the delimiter
Print' Wang LI '. Swapcase ())#Capitalize small reversal
Print' Wang Han '. Title ())#capitalize the first letter of each string
Python string manipulation