Why are rpartition() and partition() two seperate methods?
I get that one searches for the last occurrence of a specified string and the other searches for the first but is there a way to search for a specified string at any occurrence without alternating between rpartition() and partition()?
I tried something like:
txt = “I could eat bananas all day, bananas are my favorite fruit”
x = txt.partition(“bananas”, 1)
print(x)
Did not work.