爬虫

 

 

安装 request

 

beautifulsoup4安装

 

import requests
requests
import bs4
from bs4 import BeautifulSoup
bs4
url = 'http://news.gzcc.cn/html/2019/xiaoyuanxinwen_0328/11086.html'
res = requests.get(url)
type(res)
res.text
res.status_code
soupn = BeautifulSoup(res.text,'html.parser')
soupn
soupn.title.text
soupn.select('.show-info')[0].text.split()[0].split(':')[1]
soupn.select('.show-content')[0].text
soupn.select('.show-info')[0].text.split()[2].split(':')[1]

 

posted @ 2019-03-29 15:17  Kingvin_Shao  阅读(92)  评论(0编辑  收藏  举报