The partition() method splits the string at the first occurrence of the separator and returns a tuple containing the part the before separator, separator and the part after the separator. Here separator is a string which is given has the argument.
The partition() method takes a separator(a string) as the argument that separates the string at the first occurrence of it.
Returns a tuple which contains the part before the separator, separator parameter, and the part after the separator if the separator parameter is found in the string.
Returns a tuple which contains string itself and two empty strings if the separator parameter is not found.
('pawan ', 'is ', 'a good') ('pawan is a good', '', '') ('pawan ', 'is', " a good, isn't it")
('geeks ', 'is ', 'a good') ('geeks is a good', '', '') ('geeks ', 'is', " a good, isn't it")
- numpy.partition() in Python
- Python | Numpy matrix.partition()
- Python | Pandas Series.str.partition()
- String slicing in Python to check if a string can become empty by recursive deletion
- Python | Check if given string can be formed by concatenating string elements of list
- Python | Check if string ends with any string in given list
- Python | Check if a given string is binary string or not
- String slicing in Python to rotate a string
- Python String | min()
- Python String | max()
- Python String
- Python | Add one string to another
- string.whitespace in Python
- Python | String upper()
- String Formatting in Python using %
If you like GeeksforGeeks and would like to contribute, you can also write an article using contribute.geeksforgeeks.org or mail your article to firstname.lastname@example.org. See your article appearing on the GeeksforGeeks main page and help other Geeks.
Please Improve this article if you find anything incorrect by clicking on the "Improve Article" button below.