Is their any functions in python to split a string in to a list of strings ?

Fortunately we have split() built-in function in python to split a string in to a list of strings .we can define any separator, anyway default separator is any whitespace. so by default spilt() function split a string in to a list of strings based on any whitespace.

Syntax of split() function in Python

string.split(separator, maxsplit)

separator : It is an optional parameter, if we specify based on the separator value split a string in to a list of strings
maxsplit: It is also optional parameter, it specify how many number of splits to , by default it is all the occurrence.

Usage of split() function in Python

Hello_string = ” Hello, good morning ”

myitem = Hello_string.split(“, “)

print(myitem)

functions in python to split a string in to a list of strings

My Thought

Your email address will not be published. Required fields are marked *

Our Tool : hike percentage calculator