标签:wap apc 结束 lin 字符串 显示 python 分割 day
test = "axoxiuxbxfxrexds"
v = test.partition("x")#分割3份
v1=test.rpartition("x")
v2=test.split("x",3)#x会丢失
v3=test.rsplit("x",4)
print(v)
print(v1)
print(v2)
print(v3)//(‘a‘, ‘x‘, ‘oxiuxbxfxrexds‘), (‘axoxiuxbxfxre‘, ‘x‘, ‘ds‘),[‘a‘, ‘o‘, ‘iu‘, ‘bxfxrexds‘][‘axoxiu‘, ‘b‘, ‘f‘, ‘re‘, ‘ds‘]
#只能根据\n分割, True False 显示换行符
test = "axo\niu\nxbxf\nxrexds"
v=test.splitlines(True)
v1=test.splitlines(False)
print(v)
print(v1)//[‘axo\n‘, ‘iu\n‘, ‘xbxf\n‘, ‘xrexds‘],[‘axo‘, ‘iu‘, ‘xbxf‘, ‘xrexds‘]
test ="fdg"
v=test.swapcase()
print(v)
v1=v.swapcase()
print(v1)//大小写互换
#索引下标,获取字符串中的某一个字符
test ="fdfdfg"
v=test[2]
print(v) \f
切片
test ="fdfdfggrg"
v=test[2:5]#2<= 5<
print(v)//fdf
test ="郑建伟"
v=len(test)
print(v)Python 3是 3 Python 2.7 是9
6-18 0:00 -0:30结束,day 12开始 6.24开始完成习题
标签:wap apc 结束 lin 字符串 显示 python 分割 day
原文地址:https://www.cnblogs.com/yikedashuyikexiaocao/p/9194234.html