What does .split() do in python | SoloLearn: Learn to code for FREE!


What does .split() do in python

5/26/2020 9:14:06 PM


3 Answers

New Answer


Splits a string into list items according to the argument passed a="hellowo,rld" print(a.split(",")) a="hello world spam" print(a.split(" "))


you will be better off to try it in a code or read the documentation on that which will give you more insight on how the method works, that's just my 2 cent opinion for you


a = 'i like python' b = a.split() print(b) ['i', 'like', 'python'] ------------------- f = banana g = f.split('a') print(g) ['b', 'n', 'n']