Python String rsplit() Method Last Updated : 21 Apr, 2025 Comments Improve Suggest changes Like Article Like Report Python String rsplit() method returns a list of strings after breaking the given string from the right side by the specified separator. It's similar to the split() method in Python, but the difference is that rsplit() starts splitting from the end of the string rather than from the beginning. Example: Python s = "tic-tac-toe" print(s.rsplit('-')) Output['tic', 'tac', 'toe'] Explanation:rsplit() method in Python is used to split a string from the right (the end of the string) based on a specified separator.The method returns a list of substrings.Syntax of rsplit() methodstr.rsplit(separator, maxsplit)Parameters:separator: The is a delimiter. The string splits at this specified separator starting from the right side. If not provided then any white space character is a separator.maxsplit: It is a number, which tells us to split the string into a maximum of provided number of times. If it is not provided then there is no limit. Return Type: Returns a list of strings after breaking the given string from the right side by the specified separator.Error: We will not get any error even if we are not passing any argument.Note: Splitting a string using Python String rsplit() but without using maxsplit is same as using String split() MethodExamples of rsplit() method1. Splitting String Using Python String rsplit() MethodSplitting Python String using different separator characters. Python # splits the string at index 12 i.e.: the last occurrence of g word = 'geeks, for, geeks' print(word.rsplit('g', 1)) # Splitting at '@' with maximum splitting as 1 word = 'geeks@for@geeks' print(word.rsplit('@', 1)) Output['geeks, for, ', 'eeks'] ['geeks@for', 'geeks'] Explanation:The rsplit('g', 1) method splits the string at the last occurrence of the character 'g' (starting from the right). Here, the last 'g' appears at index 12 (geeks, for, geeks).The rsplit('@', 1) method splits the string at the last occurrence of '@'. The last '@' appears before the second "geeks".2. Splitting a String using a multi-character separator argument.Here we have used more than 1 character in the separator string. Python String rsplit() Method will try to split at the index if the substring matches from the separator. Python word = 'geeks, for, geeks, pawan' # maxsplit: 0 print(word.rsplit(', ', 0)) # maxsplit: 4 print(word.rsplit(', ', 4)) Output['geeks, for, geeks, pawan'] ['geeks', 'for', 'geeks', 'pawan'] Explanation:maxsplit = 0, it means no splitting occurs. The output remains the original string inside a list: ['geeks, for, geeks, pawan'].maxsplit = 4 means the string will be split at most 4 times from the right. The ', ' (comma followed by a space) is used as the separator.Related Articles:Python String split()Python String Comment More infoAdvertise with us Next Article Python String rsplit() Method P pawan_asipu Follow Improve Article Tags : Misc Python Python-Built-in-functions python-string Practice Tags : Miscpython Similar Reads Python String isnumeric() Method The isnumeric() method is a built-in method in Python that belongs to the string class. It is used to determine whether the string consists of numeric characters or not. It returns a Boolean value. If all characters in the string are numeric and it is not empty, it returns âTrueâ If all characters i 3 min read Python String isprintable() Method Python String isprintable() is a built-in method used for string handling. The isprintable() method returns "True" if all characters in the string are printable or the string is empty, Otherwise, It returns "False". This function is used to check if the argument contains any printable characters suc 3 min read Python String isspace() Method isspace() method in Python is used to check if all characters in a string are whitespace characters. This includes spaces (' '), tabs (\t), newlines (\n), and other Unicode-defined whitespace characters. This method is particularly helpful when validating input or processing text to ensure that it c 2 min read Python String istitle() Method The istitle() method in Python is used to check whether a string follows the title case formatting. In a title-cased string, the first letter of each word is capitalized, and all other letters in the word are in lowercase. This method is especially useful when working with formatted text such as tit 3 min read Python String isupper() method isupper() method in Python checks if all the alphabetic characters in a string are uppercase. If the string contains at least one alphabetic character and all of them are uppercase, the method returns True. Otherwise, it returns False. Let's understand this with the help of an example:Pythons = "GEE 3 min read Python String join() Method The join() method in Python is used to concatenate the elements of an iterable (such as a list, tuple, or set) into a single string with a specified delimiter placed between each element.Lets take a simple example to join list of string using join() method.Joining a List of StringsIn below example, 3 min read String lower() Method in Python lower() method in Python converts all uppercase letters in a string to their lowercase. This method does not alter non-letter characters (e.g., numbers, punctuation). Let's look at an example of lower() method:Pythons = "HELLO, WORLD!" # Change all uppercase letters to lowercase res = s.lower() prin 3 min read Python String lstrip() Method The lstrip() method removes leading whitespace characters from a string. We can also specify custom characters to remove from the beginning/starting of the string.Let's take an example to remove whitespace from the starting of a string.Pythons = " Hello Python!" res = s.lstrip() print(res)OutputHell 2 min read Python String partition() Method In Python, the String partition() method splits the string into three parts at the first occurrence of the separator and returns a tuple containing the part before the separator, the separator itself, and the part after the separator. Let's understand with the help of an example:Pythons = "Geeks gee 3 min read Python String replace() Method The replace() method replaces all occurrences of a specified substring in a string and returns a new string without modifying the original string.Letâs look at a simple example of replace() method.Pythons = "Hello World! Hello Python!" # Replace "Hello" with "Hi" s1 = s.replace("Hello", "Hi") print( 2 min read Like