|
马上注册,结交更多好友,享用更多功能^_^
您需要 登录 才可以下载或查看,没有账号?立即注册
x
import urllib.request
import urllib.parse
url='http://fanyi.youdao.com/translate_o?smartresult=dict&smartresult=rule'
data={}
data['type']='AUTO'
data['i']='I love you!'
data['doctype']= 'json'
data['xmlVersion']= '2.1'
data['keyfrom']=' fanyi.web'
data['ue']='UTF-8'
data['typoResult']='true'
data= urllib.parse.urlencode(data).encode('utf-8')
response=urllib.request.urlopen(url,data)
html=response.read().decode('utf-8')
print(htm)
结果
Traceback (most recent call last):
File "C:/Users/ccj/Desktop/054.py", line 24, in <module>
print(htm)
NameError: name 'htm' is not defined
最后一句是print(html)
少写了一个l
你照着打肯定不行的
视频已经是几年前的了
有道肯定会更新的
记得把地址去掉_o
你要自己去找重新写data才行
|
|