I have the following sentence
a = "you don't need a dog"
and a dictionary
dict = {"don't": "do not" }
But I can't use the dictionary to map words in the sentence using the below code:
''.join(str(dict.get(word, word)) for word in a)
Output:
"you don't need a dog"
What am I doing wrong?
See Question&Answers more detail:
os 与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…