python中split_python中split()和split(' ')的区别
生活随笔
收集整理的這篇文章主要介紹了
python中split_python中split()和split(' ')的区别
小編覺得挺不錯的,現在分享給大家,幫大家做個參考.
1 s1 = "we are family"#中間一個空格
2 s2 = "we are family"#中間兩個空格
3 s3 = "we are family"#中間三個空格
4 s4 = "we are family"#中間四個空格
5
6 s1 = s1.split(" ")7 s2 = s2.split(" ")8 s3 = s3.split(" ")9 s4 = s4.split(" ")10
11 print(s1)#['we', 'are', 'family']
12 print(s2)#['we', '', 'are', '', 'family']
13 print(s3)#['we', '', '', 'are', '', '', 'family']
14 print(s4)#['we', '', '', '', 'are', '', '', '', 'family']
總結
以上是生活随笔為你收集整理的python中split_python中split()和split(' ')的区别的全部內容,希望文章能夠幫你解決所遇到的問題。
- 上一篇: 镇国神器东风-41有多厉害?
- 下一篇: python的web页面_Python实