In this program, we will take a string as input and split a string on last occurrence of delimiter.
Steps to solve the program
- Take a string as input.
- Split the string on the last occurrence of delimiter using rsplit().
- Print the output.
#Input string
str1 = "l,e,a,r,n,I,n,g,p,y,t,h,o,n"
#Printing output
print(str1.rsplit(',', 1))
Output :
['l,e,a,r,n,I,n,g,p,y,t,h,o', 'n']