str.split([sep[, maxsplit]]) s = "123mango abcd mango kiwi peach" s.split("mango", 1) ['123', ' abcd mango kiwi peach'] >>> s.split("mango", 1)[1] ' abcd mango kiwi peach'
Here is what the above code is Doing:
1. We have a string s = “123mango abcd mango kiwi peach”.
2. We call the split() method on this string, passing the separator “mango” and the maxsplit parameter as 1.
3. The split() method returns a list of substrings.
4. We access the second element of this list (index 1) and print it.