from py_translator import Translator
translator = Translator()
我尝试:
translator.translate("i am a boy", dest='es', src='en').text
这曾经在几天前生效。现在,我在以下地方出现错误:
/anaconda2/lib/python2.7/site-packages/py_translator/gtoken.py
self.tkk = self.RE_TKK.findall(r.text)[0]
IndexError: list index out of range
答案 0 :(得分:1)
找到了该错误,并在github上进行了修复:
https://github.com/markolofsen/py_translator/pull/8/commits/410ccdcafdcc2a087b455b4e6a5eb7fef13f1c69
答案 1 :(得分:0)
试试这个:
pip 安装 googletrans==3.1.0a0
或者你可以试试这个
pip 安装 google_trans_new
参考
googletrans stopped working with error 'NoneType' object has no attribute 'group'