test = "sadaddd Zhenxian" # identifies whether all letters
V = Test. the isalpha ()
Print (V)
Test = "②123 two" # identifying whether it is currently a digital
V1 = Test. isdecimal () # decimal
Print (V1)
V2 the Test =. isdigit () # ② contains symbols
Print (v2)
v3 = the Test. IsNumeric () # include Chinese digital
Print (v3)
the Test = "ALEX" case conversion #
v = the Test. swapcase ()
Print (v)
# letters, numbers, underscores: calss identifier DEF
a = "kkk_123" # is an identifier to identify whether
V = a. isIdentifier ()
Print (V)
Test = "jdiad \ TAD" # whether there is non-displayed character # \ t Ltd. table symbol # \ n newline
V = Test. isPrintable ()
print (v)
the Test = "" # judge whether all spaces
v = the Test. isspace ()
print (v)
the Test = "TUDUDUDUDU"
v = the Test. istitle () # determine whether the title (title) = uppercase letter
print (v)
v1 = the Test. title () # to help you change the title format
Print (v1)
the Test = "you are the wind I am the sand" # string each element spliced in accordance with the specified delimiter
Print (the Test)
t = "_"
v = t. the Join (the Test)
Print (v)
the Test = "alex" # character on the left of
v = the Test. ljust (20, "*")
Print (v)
the Test = "alex" to # characters on the right
v = the Test. rjust (20, "*")
Print (v)
the Test = "alex "# pad character
Test = V. zfill (10)
Print (V)
# determines whether all of the case and the case is converted to
Test = "Alex"
V1 = Test. islower ()
V2 = Test. casefold ()
Print (V1, V2)
Test = "Alex"
V1 = Test. isupper ()
V2 = Test. Upper ()
Print (V1, V2)
Python string magic four
Guess you like
Origin www.cnblogs.com/159357zzx/p/11458178.html
Recommended
Ranking