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

+2

What does .split() do in python

5/26/2020 9:14:06 PM

Jeremy

3 Answers

New Answer

+5

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

+4

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

+3

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