科学の箱

科学・IT・登山の話題

Python

pythonからgoogle translateを使う

投稿日:2019年6月19日 更新日:

まずはパッケージをpip経由でインストール

pip install googletrans

これで完了。あとは利用するだけです。

日本語を英語に翻訳するとき。

translator = Translator()
print(translator.translate(“How are you today?.”, dest=’ja’))

結果

Translated(src=en, dest=ja, text=今日は元気ですか?。, pronunciation=None, extra_data=”{‘translat…”)

英語を日本語に訳すとき

translator = Translator()
print(translator.translate(“こんにちは、お元気ですか”, dest=’en’))

結果

Translated(src=ja, dest=en, text=Hello, how are you, pronunciation=None, extra_data=”{‘translat…”)

メタ情報

inarticle



メタ情報

inarticle



-Python

執筆者:


comment

メールアドレスが公開されることはありません。 * が付いている欄は必須項目です

関連記事

no image

dataframeのgroupbyで使えるメソッド

Dataframeでgroupby経由で使宇メソッド。基礎統計で大事そうなものだけを記載。 mean() sum() std() count() max(), min() describe() Rel …

no image

numpyで配列を抜き出す方法

numpyで配列を抜き出す まず基本となるやり方 arr = np.arange(50).reshape(5,10) arr[1:1,] arr[1:2,]   np.arange(50)で …

no image

pythonで配列に関係する型

pythonで配列に関連する型は3つある。 list array numpy.ndarray pandas.dataframe list 違っている複数のデータ型を要素として保持できる 多次元配列可能 …

no image

PythonでMicrosoft Visual C++ 14.0 is required エラーが出た場合

Visual Studio 2017だけでは不十分である。   https://visualstudio.microsoft.com/ja/downloads/から下記のリンク経由でBuil …

no image

pythonからoffice365 smtpを利用してメールを送信

Office365の設定はこちらにある。 PythonにおけるSMTPの利用はこちらにある。 下記はサンプルコード import smtplib from email.mime.text import …

2019年6月
« 5月   7月 »
 12
3456789
10111213141516
17181920212223
24252627282930

side bar top



アーカイブ

カテゴリー