标签:center art 字符串 cap for print ase format case
test = "alex"
v = test.capitalize() #首字母大写
print (v)
v1 = test.casefold()#所有变有小写
print(v1)
v2 = test.lower()
print(v2)
v3 = test.center(20,"#)
print (v3)
结果:########alex########
test = "alexalexr"
v4 = test.count(‘e‘)
print (v4)
结果:2
v4 = test.count(‘e‘,5)
结果:1
v5 = test.endswith(‘ex‘)
v6 = test.startswith(‘ex‘)
test = "i am {name},{age}"
v = test.format(name=‘alex‘,age=19)
test = "i am [0],[1]"
v = test.format("alex",19")
test = "uasf890"
v = test.isalnum() #只能字母+数字
标签:center art 字符串 cap for print ase format case
原文地址:https://www.cnblogs.com/wrw202/p/9533417.html