demo_ref_string_rsplit2.py:
txt = "apple, banana, cherry" # setting the max parameter to 1, will return a list with 2 elements! x = txt.rsplit(", ", 1) print(x)
C:\Users\My Name>python demo_string_rsplit2.py
['apple, banana', 'cherry']