Python网络爬虫(1)
来源:互联网 发布:node express -e 编辑:程序博客网 时间:2024/06/05 04:53
爬虫三步:请求 解析 存储
import requests #导入requests 库
r=requests.get('http://www.wise.xmu.edu.cn/people/faculty')
html=r.content #获取网页全部内容
print r.status_code,r.encoding #返回请求状态 字码形式
from bs4 import BeautifulSoup#利用bs4进行解析
soup=BeautifulSoup(html,'html.parser')
div_people_list=soup.find('div',attrs={'class':'people_list'})
a_s=div_people_list.find_all('a',attrs={'target':'_blank'})
for a in a_s:
url=a['href']
name=a.get_text()
print name,url#直接打印出来,就当存储了
0 0
- Python网络爬虫(1)
- [Python]网络爬虫1
- Python网络爬虫1
- 【网络爬虫】【python】网络爬虫(一):python爬虫概述
- Python网络爬虫(1)获取网页
- python网络爬虫(1)--抓取图片
- 【Python爬虫1】网络爬虫简介
- python 网络爬虫入门 1
- python 3.0 网络爬虫 1
- Python网络爬虫演示-1
- python网络爬虫day'1
- python网络爬虫(一)
- python网络爬虫(一)
- python网络爬虫(二)
- python网络爬虫(三)
- python网络爬虫(一)
- python网络爬虫(二)
- python网络爬虫(三)
- mysql插入数据自增
- Java中的异常处理
- Pixhawk的飞行模式,控制模式解读(原生固件)
- 明天粗分啦!!
- printf关于支持可变参数
- Python网络爬虫(1)
- 数组中制定元素排序
- div背景颜色设置成渐变色
- JavaScript基础:JavaScript简介
- 第13周项目三—形状类族的纯虚函数
- 最大子段和
- 剑指offer---合并两个排序的链表
- os模块与sys模块
- PDB文件:每个开发人员都必须知道的