CKTIS / Python
str.rsplit
Splitst vanaf rechts. Standaard kiest sep=None groepen witruimte en maxsplit=−1 onbeperkt splitsen.
Versie: Python 3.14; repository image, production runtime not attested
Syntax
s.rsplit(sep=None, maxsplit=-1)Splitst vanaf rechts. Standaard kiest sep=None groepen witruimte en maxsplit=−1 onbeperkt splitsen.
Eén splitsing op de dubbele punt in a:b:c laat links a:b staan.
De expliciete dubbele punt aan het einde van a: geeft een leeg laatste veld.
assert "a:b:c".rsplit(":", 1) == ["a:b", "c"] and "a:".rsplit(":")[-1] == ""
Voorbeelden
print("a:b:c".rsplit(":", 1))
print("a:".rsplit(":", 1))
Resultaat
['a:b', 'c'] ['a', '']
De expliciete dubbele punt aan het einde van a: geeft een leeg laatste veld.