支付宝赞助帐号:service@kuitao8.com 

python实现百度搜索

Created2018-01-21   Views 279    Author 懒人程序
search_url='http://www.baidu.com/s?wd='+question1+'&rsv_bp=0&ch=&tn=json&bar=&rsv_spt=3&ie=utf-8&rsv_sug3=3&rsv_sug=0&rsv_sug1=2&rsv_sug4=161&inputT=17931'
req = url.urlopen(search_url)
html = req.read()
soup = BeautifulSoup(html, "html.parser")
haha = soup.decode('utf-8').encode('gbk')
haha1 = haha.decode('gbk').encode('utf-8')
list = []
Arr = json.loads(haha1)
re_s = Arr['feed']['entry'];
c_Result = ''
for list in re_s:
        print(list['title'] + '\n' + list['abs'])

下载地址 http://img.kuitao8.com/uploads/2018/0121/20180121120727970.zip

上一篇: ffmpeg命令:wav转pcm,pcm转wav[转载]
下一篇: 解决123.543891.com篡改Chrome的主页
支持键盘 ← →

邮件订阅

订阅我们的精彩内容