This method will split the string into three-part based on the first occurrence of the argument string and return it in the form of a tuple.
The first part will be the string before the first occurrence of the argument, the second part is itself an argument and the third part will be the string after the first occurrence of the argument.
#separator - It is a string which will split the original string
into 3 parts.
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 part it will return whole string, second and third part will be returned empty.
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