req= requests.get(url=url, headers=headers , timeout=8)returnreqdefbuildUrl(self):'''封装请求url sl:要转换的文字 tl:转换的结果类型 q要输入的文字'''baseUrl='http://translate.google.cn/translate_a/single'baseUrl+='?client=webapp&'
To install, either use things like pip with the package "pygoogletranslation" or download the package and put the "pygoogletranslation" directory into your python path. $ pip install pygoogletranslation Basic Usage If source language is not given, google translate attempts to detect the source l...
gTTS (Google Text-to-Speech), a Python library and CLI tool to interface with Google Translate's text-to-speech API. Write spoken mp3 data to a file, a file-like object (bytestring) for further audio manipulation, or stdout. https://gtts.readthedocs.io/...
首先打开Google translate的界面: 找到包含我们所需要的信息的Request 这个request返回的是一个json文件 这个api的地址为:https://translate.google.com/translate_a/single?client=t&sl=en&tl=zh-CN&hl=zh-CN&dt=at&dt=bd&dt=ex&dt=ld&dt=md&dt=qca&dt=rw&dt=rm&dt=ss&dt=t&ie=UTF-8&oe=UTF-8&...
sys.setdefaultencoding('utf-8')#python处理字符流改成utf-8形式 def translate_text(target, content): language_type = "" url = "https://translation.googleapis.com/language/translate/v2" data = { 'key':"AI***mpI", 'source': language_type, 'target...
/usr/bin/env python3 # -*- coding: utf-8 -*- import os import time from googletrans ...
Google Translate API的优势包括: 准确性:Google Translate API使用了先进的机器学习算法和大规模的语料库,能够提供较高的翻译准确性。 多语言支持:Google Translate API支持多种语言之间的翻译,包括常见的主流语言以及一些较为罕见的语言。 简单易用:Python中的Google Translate API提供了简单易用的接口,开发者可以轻松...
>>> from python_google_translator import translator >>> print translator.translate(sl='en', tl='zh-CN', content='Hi,\nWhat time is it?', proxy='qi:ws2013@127.0.0.1:8080') 您好! 现在是什么时候? 参数说明: sl - 原语言。 tl - 翻译成的目标语言。 content - 要翻译的内容。 proxy -...
Google Translate (opens new window) enables fast translation of any text into a wide range of supported languages using advanced Neural Machine Translation technology. It also offers language detection for cases where the source language is unknown. The underlying technology is continuously updated with...
操作ID: TextTranslate 入力テキストを翻訳し、翻訳されたテキストを返します。 パラメーター テーブルを展開する 名前キー必須型説明 テキスト q True string 翻訳する入力テキスト。 複数のフレーズを翻訳するための文字列の配列を提供します。 文字列の最大数は 128 です。 ターゲット...