# Python - String rpartition() Method

The string rpartition() method is used to create three partition of the string and returns them in tuple form. The three elements of tuple will be: portion of the string before last occurrence of the specified character(s), the specified character and remaining portion of the string after last occurrence of the specified character(s).

### Syntax

string.rpartition(characters)


### Parameters

 characters Required. specify character(s) which need to be searched in the string.

### Example:

In the below example, rpartition() method is used to create three partition of the string and returns them in tuple form.

MyString = "Python#Java#C++"
print(MyString.rpartition("#"))


Output

('Python#Java', '#', 'C++')


### Example:

If the specified character(s) is not present in the string then the three elements of tuple will be: the whole string, ' ' and ' '.

MyString = "Python#Java#C++"
print(MyString.rpartition("Javascript"))


Output

('', '', 'Python#Java#C++')