What's the recommended Python idiom for splitting a string on the last occurrence of the delimiter in the string? example:
# instead of regular split
>> s = "a,b,c,d"
>> ['a', 'b', 'c', 'd']
# ..split only on last occurrence of ',' in string:
>>> s.mysplit(s, -1)
>>> ['a,b,c', 'd']
>>> s = "a,b,c,d" >>> s.rsplit(',', 1) ['a,b,c', 'd'] >>> s.rsplit(',', 2) ['a,b', 'c', 'd']
This method starts splitting from the right-hand-side of the string; by giving it a maximum, you get to split just the right-hand-most occurrences.