Strings are mainly based on memorization, just play more.
_author_ = "Happyboy" name = "my \tname is happyboy and i am 66 year old" print (name.capitalize()) #capitalize the first letter print (name.count( ' a ' )) # count how many a print (name.center(50, " - " )) # need 50 strings print ( name.endswith( " oy " )) #Determine whether oy ends print (name.expandtabs(tabsize=30)) #Set a few spaces in the string \t print (name[name.find( " name " ):] ) #String slice print (name.isalnum()) #Determine whether this is Arabic numerals plus English print( ' abA ' .isalpha()) #Test whether this is in English print ( ' 1A ' .isdecimal()) print ( ' 1A ' .isdigit()) #Test whether this is an integer print ( ' d1A ' .isidentifier() ) #Test if this is a valid identifier print ( ' 33.33 ' .isnumeric()) #Test if this is a number print ( ' 33A ' .isspace()) #Test if this is a space print ( ' My Name Is' .istitle()) #Test whether each first letter is capitalized print ( ' My Name Is ' .isprintable()) #Test whether this can be printed, the string is basically useless print ( ' My Name IS ' .isupper ()) #Test if it is all uppercase print ( ' + ' .join([ ' 1 ' , ' 2 ' , ' 3 ' , ' 4 ' ])) # Turn the list into a string print (name.ljust( 50, ' * ' )) #Guaranteed string length of 50, not enough / make up print (name.rjust(50, " - " )) #Same as above print ( ' Happyboy ' .lower()) #All lowercase print ( ' Happyboy ' .upper ( )) # All uppercase print ( ' \nHappyboy ' .lstrip()) #to the left space and carriage return print ( ' Happyboy\n ' .rstrip()) #to the right space and carriage return print ( ' Happyboy\n ' .strip ()) # Remove all spaces and carriage returns p = str.maketrans( " abcdef " , ' 123456 ' ) #assign abcdef to 123456 print ( " abcdef " .translate(p)) #output abcdef print ( ' Happyboy ' .replace( ' b ' , ' B ' )) #Replace b with B print ( ' Happyboy ' .rfind( ' H ' )) #Check the rightmost character, the character starts from 0 print ( ' 1+2+3+4+5 ' .split( ' + ' )) #Split the string out print ( ' 1+2\n+3+4+5 ' .splitlines()) #Automatically recognize newlines print ( 'Happyboy' .swapcase()) #The first letter is lowercase, the others are all uppercase print ( ' HappyBoy ' .title()) #The first letter is uppercase, the rest are all lowercase print ( ' HappyBoy ' .zfill (50)) #Autocomplete