Both split() function and slicing work on a String object.
By using split() function, we can get the list of words from a String.
E.g.
‘a b c ‘.split() returns [โaโ, โbโ, โcโ]
Slicing is a way of getting substring from a String. It returns another String. E.g.
‘a b c'[2:3] returns b
Leave a Reply