How to split a string on last occurrence of a delimiter in Python

1 Answer

0 votes
s = "python, java, c#, php"

lst = s.rsplit(', ', 1) 
  
print(lst) 



'''
run:

['python, java, c#', 'php']

'''

 



answered Jan 5, 2020 by avibootz
...