Python String rpartition() MethodPython Functions

Difficulty Level:
Difficulty Level:

The rpartition() splits a string at the last occurrence of the argument string.

Example

#!/usr/bin/python3
# -*- coding: UTF-8 -*-

str = "www.ABCabcABC.com"

print(str.rpartition("."))

Output:

('www.ABCabcABC', '.', 'com')

Syntax

str.rpartition(separator)

Parameters

The method takes a string (separator) as the parameter.

Return Value

It returns a 3-tuple containing the part before separator, separator, and the part after separator.

Advertisement

© 2021 Pythonexample.org, all rights reserved. Privacy Policy | Contact Us