str.split(' ') giving me "ValueError: empty separator" for a sentence in the form of a string
ya had same issue on this exercise from 'Python the hardway'. I just had to put a space between the quote marks.
def breakWords(stuff):
"""this function will break up words."""
words = stuff.split(" ")
return words
also as someone mentioned you have to reload the module. although in this example, since using a command prompt in windows i had to exit() then restart my py session and import the exercise again.
As the debugger output below shows, this error is generated by an empty parameter to split
>>> s="abc def ghi jkl"
>>> s.split(" ")
['abc', 'def', 'ghi', 'jkl']
>>> s.split("")
Traceback (most recent call last):
File "<stdin>", line 1, in <module>
ValueError: empty separator
>>>
Your code must be passing an empty value to split. Fix this and the error will go away.