Definition
The rpartition() method searches for the last occurrence of a specified string, and splits the string into a tuple containing three elements. The first element contains the part before the specified string; the second contains the specified string; the third contains the part after the string.
Syntax
string.rpartition(value)
Parameters
Parameter | Description |
---|---|
value | Required. The string to search for |
Examples:
testStr = "Welcome to the Python tutorials."
result = testStr.rpartition("the")
print(result)