use of split function in python
At some point, you may need to break a large string down into smaller chunks, or strings. This is the opposite of concatenation which merges or combines strings into one.To do this, you use the split function in python. What it does is split or breakup a string and add the data to a string array using a defined separator.If no separator is defined when you call upon the function, white space will be used by default. In simpler terms, the separator is a defined character that will be placed between each variable.
example
x = ‘blue,red,green’
x.split(“,”)
>>>[‘blue’, ‘red’, ‘green’]
>>> a,b,c = x.split(“,”)
>>> a
‘blue’
>>> b
‘red’
>>> c
‘green’