The string.split() method in Python splits a string into a list and returns a list of the words in the string. If the parameter maxsplit is given, at most maxsplit splits are done. If maxsplit is not specified, then there is no limit on the number of splits.



sep(optional) :  This parameter Specifies the separator to use when splitting the string. The default value is whitespace. If the parameter ‘sep’ is not specified or is none, a different splitting algorithm is applied.

Maxsplit(optional) :  This parameter specifies how many splits to do. The Default value is -1, which is “all occurrences”.


This method returns a list of the words in the string, using sep as the delimiter string.

Example 1


Example 2


Example 3


Pin It on Pinterest

Share This