标签:count string 方法 python 默认 列表 http target 语法
描述:
python rsplit() 方法通过指定分隔符对字符串进行分割并返回一个列表,默认分隔符为所有空字符,包括空格、换行(\n)、制表符(\t)等。类似于 split() 方法,只不过是从字符串最后面开始分割。
语法:S.rsplit([sep
=
None
][,count
=
S.count(sep)])
参数:
返回值:返回分割后的字符串列表。
实例:
S
=
"this is string example....wow!!!"
print
(S.rsplit( )) [
‘this‘
,
‘is‘
,
‘string‘
,
‘example....wow!!!‘
]
print
(S.rsplit(
‘i‘
,
1
)) [
‘this is str‘
,
‘ng example....wow!!!‘
]
print
(S.rsplit(
‘w‘
)) [
‘this is string example....‘
,
‘o‘
,
‘!!!‘
]
标签:count string 方法 python 默认 列表 http target 语法
原文地址:https://www.cnblogs.com/gengshao/p/11589482.html