#split():把字符串按空格分开
a = '1\n2\n3'
b = a.split()
print(b)
# 结果:['1', '2', '3'] \n判断为空格
a = '1#2#3'
b = a.split('#',2)
print(b)
# 结果:['1', '2', '3'] 第二参数为分隔成几个
#split():把字符串按空格分开
a = '1\n2\n3'
b = a.split()
print(b)
# 结果:['1', '2', '3'] \n判断为空格
a = '1#2#3'
b = a.split('#',2)
print(b)
# 结果:['1', '2', '3'] 第二参数为分隔成几个
本文标题:函数4:split
本文链接:https://www.haomeiwen.com/subject/adsguhtx.html
网友评论