You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
import json
import requests
apikey="3ca7eb8b8ad0f8fe04a96fc3d52bfc11"
lines=["hello","How are you?"]
def translate(sentence, src_lan, tgt_lan):
url = 'http://api.niutrans.com/NiuTransServer/translation?'
data = {"from": src_lan, "to": tgt_lan, "apikey": apikey, "src_text": sentence}
res = requests.post(url, data = data)
res_dict = json.loads(res.text)
if "tgt_text" in res_dict:
result = res_dict['tgt_text']
else:
result = res
return result
if name == "main":
for line in lines:
try:
trans = translate(line, 'auto', 'zh')
print(trans)
except Exception as exc:
print(exc)
前言:
请务必详细阅读使用指南和项目的project并在Issuse中查找您问题的关键词,您想要的特性有很大的可能已经被实现/已经在计划中/由其他人提出了,CopyTranslator经过多次迭代,功能越来越丰富(
复杂),不阅读完整使用指南无法完全发挥其功能,如果您阅读完上述内容,确定该特性未被实现/未计划实现。非常欢迎您继续下面的工作提出增加新特性的请求。您的功能请求是否与问题有关?请描述一下.
简明扼要地描述了问题所在。
描述您想要的解决方案
简明扼要地描述您想要发生的事情。
描述您考虑过的替代方案
对您考虑的任何替代解决方案或功能的简明扼要描述。
附加背景
在此处添加有关功能请求的任何其他上下文或屏幕截图。
The text was updated successfully, but these errors were encountered: