python中英文翻译模块

您所在的位置:网站首页 chinese英语翻译成中文 python中英文翻译模块

python中英文翻译模块

#python中英文翻译模块| 来源: 网络整理| 查看: 265

从一种语言到另一种语言的文本翻译在各种网站中越来越普遍。 帮助我们执行此操作的python包称为translate。 可以通过以下方式安装此软件包。 它提供主要语言的翻译。

官网:https://pypi.org/project/translate/

安装

pip install translate   1

使用方法:

# encoding: utf-8 from translate import Translator # 以下是将简单句子从英语翻译中文 translator= Translator(to_lang="chinese") translation = translator.translate("Good night!") print translation # 在任何两种语言之间,中文翻译成英文 translator= Translator(from_lang="chinese",to_lang="english") translation = translator.translate("我想你") print translation   1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 D:\Python27\python.exe F:/PycharmProjects/tom/文本翻译功能.py 晚安! I missed you. Process finished with exit code 0   1 2 3 4 5

果然牛逼啊



【本文地址】


今日新闻


推荐新闻


CopyRight 2018-2019 办公设备维修网 版权所有 豫ICP备15022753号-3