【问题标题】:Python translation using goslate使用 goslate 进行 Python 翻译
【发布时间】:2021-06-04 22:55:39
【问题描述】:

我正在构建一个翻译器,它使用 python 将用户输入翻译成法语。然而,我遇到了一个挑战,我的 goslate 函数无法捕获用户输入并进行翻译。感谢您的帮助。

import goslate
gs = goslate.Goslate()

text = input("please input the word you would like translated:\n")
gs.translate(text,'fr')

【问题讨论】:

  • 您的意思是当您运行上述代码时,您在输出控制台上看不到任何内容?如果是这种情况,请检查@trivvz 答案。

标签: python goslate


【解决方案1】:

您必须打印输出或将其保存到变量中。例如

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

查看the documentation了解更多详情。

【讨论】:

    猜你喜欢
    • 2014-07-14
    • 2012-03-13
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 2018-02-24
    • 2019-10-14
    • 2014-04-21
    相关资源
    最近更新 更多