split string in to 2 based on last occurrence of a separator
>>> "a b c,d,e,f".rsplit(',',1)
['a b c,d,e', 'f']
Use rpartition(s)
. It does exactly that.
You can also use rsplit(s, 1)
.
>>> "a b c,d,e,f".rsplit(',',1)
['a b c,d,e', 'f']
Use rpartition(s)
. It does exactly that.
You can also use rsplit(s, 1)
.