我正在构建一个翻译器,它使用 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
查看文档以获取更多详细信息。