python3 终端下英汉词典 BeautifulSoup+网络爬虫,,#!/usr/bin/e
文章由Byrx.net分享于2019-03-23 09:03:00
python3 终端下英汉词典 BeautifulSoup+网络爬虫,,#!/usr/bin/e
#!/usr/bin/env python3from bs4 import BeautifulSoupimport tornado.httpclientcli=tornado.httpclient.HTTPClient()link='http://www.iciba.com/'search=input('search: ')link+=searchdata=cli.fetch(link)body=data.body.decode('utf8')soup=BeautifulSoup(body)group=soup.find_all(class_='group_pos')group2=group[0].find_all('p')for ele in group2: print(ele.find(class_='fl').get_text()) result=ele.find_all('label') for r in result: print(r.get_text())#该片段来自于http://byrx.net
评论关闭