日韩av黄I国产麻豆传媒I国产91av视频在线观看I日韩一区二区三区在线看I美女国产在线I麻豆视频国产在线观看I成人黄色短片

歡迎訪問 生活随笔!

生活随笔

當前位置: 首頁 >

python在线翻译脚本_python写一个翻译的小脚本

發布時間:2024/10/8 46 豆豆
生活随笔 收集整理的這篇文章主要介紹了 python在线翻译脚本_python写一个翻译的小脚本 小編覺得挺不錯的,現在分享給大家,幫大家做個參考.

起因:

想著上學看不懂English的PDF感慨萬分........

然后就有了翻譯的腳本。

截圖:

代碼:

#-*- coding:'utf-8' -*-

import requests

import json

import time

start=time.time()

def live():

while True:

content=input('輸入你要翻譯的:')

if content=="e":

break

chrome={"user-agent":"Mozilla/5.0 (Windows NT 6.1; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/63.0.3239.132 Safari/537.36"}

url="https://fanyi.youdao.com/openapi.do?keyfrom=123licheng&key=1933182090&type=data&doctype=json&version=1.1&q={}".format(content)

html=requests.get(url,headers=chrome)

resqer=html.content

load=json.loads(resqer)

print(load["translation"][0])

live()

exit=time.time()

print('[+]該程序耗時',exit-start)

總結

以上是生活随笔為你收集整理的python在线翻译脚本_python写一个翻译的小脚本的全部內容,希望文章能夠幫你解決所遇到的問題。

如果覺得生活随笔網站內容還不錯,歡迎將生活随笔推薦給好友。