I copied this code from a book:
lyst = {'Hi':'Hello'}
def changeWord(sentence):
def getWord(word):
lyst.get(word, word)
return ''.join(map(getWord, sentence.split()))
I get this error:
Traceback (most recent call last):
File "<pyshell#4>", line 1, in <module>
cambiaPronome('ciao')
File "C:\Python33\2.py", line 6, in cambiaPronome
return ''.join(map(getWord, list(frase)))
TypeError: sequence item 0: expected str instance, NoneType found
What is wrong?
return ''.join(map(getWord, list(frase)))is not from the book. Why don't you show us the actual code you wrote?getWordmethod.returnline.)