python 百度翻译接口测试

import requests

word = input("输入您要翻译的单词:")
url="https://fanyi.baidu.com/sug" #百度翻译接口
dict = {"kw":word}
#发送的数据必须放到字典中,通过data发送
resp = requests.post(url,data=dict)

print(resp.json())  #将服务器返回的内容直接处理成json数据格式

猜你喜欢

转载自blog.csdn.net/weixin_47401101/article/details/121016889