split() and split(" ") and different:
>>> a = "hello world"
>>> a.split()
['hello', 'world']
>>>
>>> a.split(" ")
['hello', '', '', '', '', 'world']
splitlines and split("\n") are different:
>>> "".splitlines() # this will return an empty list
[]
>>> "".split("\n") # this will return an one-element list
['']
>>>
>>> "my line\n".splitlines()
['my line']
>>> "my line\n".split("\n")
['my line', '']
Top comments (0)