This method will split the string into three-part based on the last occurrence of the argument string and return it in the form of a tuple.
The first part will be the string before the last occurrence of the argument, the second part is itself an argument and the third part will be the string after the last occurrence of the argument.
#separator - It is a string that will split the original string
into 3 parts based on the last occurrence of the separator.
str1 = "Sam is good in math, but he is bad in english"
# 'is' separator is found, wil split it at first occurence
# 'not' separator is not found
('Sam is good in math, but he ', 'is ', 'bad in english')
('', '', 'Sam is good in math, but he is bad in english')
In the above program, if the argument is not found in the string, then in first and second part it will returned empty string, in third part it will return whole string.
Best learning portal that provides you great learning experience of various technologies with modern compilation tools and technique
Don't hesitate to give us a call or send us a contact form message