message = input(">")
words = message.split(' ')
emojis = {
":)": "😊"
":(": "😔"
}
output = ""
for word in words:
output += emojis.get(word,word) + ' '
print(output)
这是语法错误。我不明白为什么冒号不正确。
line 6
":(": "😔"
^
SyntaxError: invalid syntax
您需要添加逗号来分隔字典元素:
emojis = {
":)": "😊", # <- added comma here
":(": "😔"
}