A common method in python str Summary (1)

= A ' strABC ' 

# Strabc: initials, all lowercase other 
B = a.capitalize ()
 Print (B) 

# STRABC: all uppercase 
C = A.upper ()
 Print (C) 

# strabc: all lower case 
D = A .lower ()
 Print (D) 

# STRabc sensitive flip 
E = a.swapcase ()
 Print (E) 

# Abc * Jkl.Mno Edf_Ghi, PQR, Stu (and Vw) Xy4Z spaced apart in a non-English letters capitalized 
a = " abc edf_ghi * jkl.mno, PQR, STU (vw) xy4z " 
b = a.title ()
 Print (b) 

######## python ####### (width, the filler (space by default)) centered character 
STR = " Python " 
str1 = str.center (20 is, " # " )
 Print (str1) 

# ABC DEF 
# a tab DEF occurs when the string, with a multiple of eight spaces full complement tab, so that the subsequent character alignment 
STR = " ABC \ TDEF " 
str1 = " a \ TDEF " 
str2 = str.expandtabs () 
Str3 = str1 .expandtabs ()
 Print (str2)
 Print (str3)

 

Guess you like

Origin www.cnblogs.com/aiworld/p/11612772.html