def rsplit(self, sep=None, maxsplit=-1)
-
sep
: 分割符 -
maxsplit
: 最大分割次数!
a = '123.456.789'
print(a.rsplit('.', 1))
print(a.rsplit('.', 2))
['123.456', '789']
['123', '456', '789']
def rsplit(self, sep=None, maxsplit=-1)
sep
: 分割符maxsplit
: 最大分割次数!
a = '123.456.789'
print(a.rsplit('.', 1))
print(a.rsplit('.', 2))
['123.456', '789']
['123', '456', '789']
本文标题:Python: str 对象方法
本文链接:https://www.haomeiwen.com/subject/upzrvftx.html
网友评论