Explain Split and Join function in Python?

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. We can use the function split() to split a string and join() to join a string.

Examples :

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