python - googletrans JSONDecodeError 在翻译时
问题描述
我正在使用以下命令安装 Google Trans:
pip install google_trans_new
然后:
import googletrans
from google_trans_new import google_translator
translator = google_translator()
translate_text = translator.translate('hola',lang_tgt='en')
print(translate_text)
但我得到这个错误:
"JSONDecodeError Traceback (most recent call last)
<ipython-input-17-92dfe7fca89f> in <module>()"
我也尝试像这个例子一样在谷歌合作中使用它并得到同样的错误。 https://towardsdatascience.com/google-translate-api-for-python-723093c2144b
解决方案
推荐阅读
- asp.net - 将空字符串转换为数字时出现 DBnull 问题
- html - 在图标之间绘制垂直线
- appium - 如何在appium自动化中自动化飞行模式
- node.js - 使用 npm 安装任何软件包时出错
- sql-server - 如何在sql中按客户的天数计算金额
- visual-studio-code - 将按键绑定到使用 Visual Studio 代码中的当前文件的 shell 命令
- django - Django 从 1000 开始 id 字段
- c# - 在控制器中编写 ModelState 验证代码作为它自己的方法,以便它可以被多个 ActionResults 调用
- javascript - 如何使用 Javascript 删除文本
- c - 如何在c中声明一个动态的char数组