我正在构建一个使用python将用户输入翻译成法语的翻译器。然而,我遇到了一个挑战,我的goslate函数没有捕获用户输入并翻译它。我很感激你的帮助。
import goslate
gs = goslate.Goslate()
text = input("please input the word you would like translated:n")
gs.translate(text,'fr')
您必须打印输出或将其保存到一个变量中。例如
import goslate
gs = goslate.Goslate()
text = input("please input the word you would like translated:n")
print(gs.translate(text,'fr'))
输出:
please input the word you would like translated:
Hello
Bonjour
查看文档了解更多详细信息。