demo_ref_string_split4.py:
txt = "apple#banana#cherry#orange" # setting the max parameter to 1, will return a list with 2 elements! x = txt.split("#", 1) print(x)
➜ begtut>python demo_string_split4.py
['apple', 'banana#cherry#orange']