我正在尝试创建一个程序,该程序接受输入,然后将其从澳大利亚原住民语言转换为英语。虽然程序的其余部分正常运行,但输出以错误的格式打印。我收到的输出是:
ngaju
kuja-piya
malilyi
我希望收到的是:ngaju kuja-piya malilyi
这是我的完整代码:
dictionary = open('dictionary.txt')
words = {}
for line in dictionary:
english, aboriginal = line.split(',')
words[english] = aboriginal
translator = input("English: ")
while translator:
sentence = translator.split()
for word in sentence:
print(words[word], end='')
translator = input("English: ")
以下是字典的内容.txt:
afternoon,wuraji-wuraji
I,ngaju
bird,jirripirdi
like,kuja-piya
dance,juka-pinyi
python,malilyi
laugh,ngarlarrimi
we,ngalipa
人到中年有点甜
慕斯709654
相关分类