a2421480 发表于 2019-1-7 22:18:27

爬虫问题

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['version'] ='2.1'
data['keyfrom'] = 'fanyi.web'
data['ue'] = 'UTF - 8'
data['typoResult'] = 'false'
data = urllib.parse.urlencode(data).encode('utf - 8')
response = urllib.request.urlopen(url,data)
html = response.read().decode('utf - 8')
print(html)


结果打印出了{"errorCode":50}啥情况?

幽梦三影 发表于 2019-1-7 22:29:53

https://fishc.com.cn/forum.php?mod=viewthread&tid=106892&highlight=%7B%2Bquot%3BerrorCode%2Bquot%3B%3A50%7D
页: [1]
查看完整版本: 爬虫问题