-
Notifications
You must be signed in to change notification settings - Fork 0
Open
Description
语法:
str.split(str="", num=string.count(str))str --> 分隔符,默认为所有的空字符 包括空格 换行(\n) 制表符(\t)等。
num --> 分割次数。
例子:
str = "Line1-abcdef \nLine2-abc \nLine4-abcd";
print str.split( )
print str.split(' ', 1 )['Line1-abcdef', 'Line2-abc', 'Line4-abcd']
['Line1-abcdef', '\nLine2-abc \nLine4-abcd']s = "there is a string here"
s.splt() # ['there','is','a','string','here']
s.split(" ",1) #['there','is a string here']
s.spilt(" ",2) # ['there','is','a string here']Metadata
Metadata
Assignees
Labels
No labels