str operation
"" " S = 'aluxemsnk' S1 = s.capitalize () # initials s2 = s.upper () # all caps s3 = s.lower () # all lowercase s4 = s1.swapcase () # Flip case = S 'ADA wewf AAGG tetg' S5 = s.title () # separated by spaces or special characters capitalized names Print (S4, S5) S = 'aluxemsnk' S1 = s.center (30, '@' ) Print (S1) # public method s = 'ha' Print (len (S)) s = 'asdaff' S7 = s.startswith ( 'AS') Print (S7) s = 'aluxemsnk' S8 = s.find ( 'm') Print (S8, type (S8)) S9 = s.index ( 'O') Print (S9) S = 'aasdas asdfg GER ERG' S10 = S.Strip () to the left and right boundary spaces # Print (S10) S = 'aasdas asdfg GER ERG' print (s.count ( 'a') ) # Number number S = ': aasdas: asdfg: GER ERG' Print (s.split ( ':')) # split into two text files, but also a space element, when the difference must be split from str ----> list string into a list #s = 'my name is {0}, {1} ages, hobbies {1}'. format ( 'Bai', '20 ',' haha ') #Print (S) S =' my name {name}, Age {age}, hobbies {hobay} '. format (name =' Bai ', age =' 20 ', hobay =' haha ' ) may be substituted in place of the placeholder% Print (S) S = 'Aspen Steven pride Jing branch documentation is' Print (s.replace does ( 'A', 'H')) "" " S = ' asdffgerfgfgv ' for I in S : Print (I)