菜鸟IT的博客 >> Python
python自带的谷歌翻译库 | Google翻译
https://baijiahao.baidu.com/s?id=1711125310339574224&wfr=spider&for=pc
from googletrans import Translator
translator = Translator(service_urls=[
'translate.google.cn'
])
# text: str, dest='en', src='auto')
t1 = translator.translate('Good Morning', dest='zh-CN')
t2 =translator.translate('.', dest='ja')
t3 =translator.translate('veritas lux mea', src='la')
print(t1.text)
print(t2.text)
print(t3.text)
# translate默认参数:
# translator.translate(text, dest="en", src='auto')
# ————————
详细介绍以及更高级的用法:http://t.zoukankan.com/-wenli-p-12286779.html
菜鸟IT博客[2022.06.15-13:56] 访问:383