Python program to Split a string based on a delimiter and join the string using another delimiter.
Split a string can be quite useful sometimes, especially when you need only certain parts of strings. A simple yet effective example is splitting the First-name and Last-name of a person. Another application is CSV(Comma Separated Files). We use split to get data from CSV and join to write data to CSV.
Split the string into list of strings Input : Geeks for Geeks Output : ['Geeks', 'for', 'Geeks'] Join the list of strings into a string based on delimiter ('-') Input : ['Geeks', 'for', 'Geeks'] Output : Geeks-for-Geeks
Below is Python code to Split and Join the string based on a delimiter :
['Geeks', 'for', 'Geeks'] Geeks-for-Geeks
- Python | Pandas str.join() to join string/list elements with passed delimiter
- Python | Pandas Split strings into two List/Columns using str.split()
- Python Program to perform cross join in Pandas
- Python String Methods | Set 2 (len, count, center, ljust, rjust, isalpha, isalnum, isspace & join)
- numpy string operations | join() function
- Python program to split the string and convert it to dictionary
- Python | Merge, Join and Concatenate DataFrames using Panda
- Python program to split a string by the given list of strings
- join() function in Python
- Python | Join tuple elements in a list
- Python | os.path.join() method
- Python | Ways to join pair of elements in list
- Python | Join cycle in list
- Python - Consecutive K elements join in List
- Python MySQL - Join
- Python - Join Tuples to Integers in Tuple List
- Python - Join Tuples if similar initial element
- Python - Cross Join every Kth segment
- Join two text columns into a single column in Pandas
- Tableau - Join databases
If you like GeeksforGeeks and would like to contribute, you can also write an article using contribute.geeksforgeeks.org or mail your article to email@example.com. 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.