网络爬虫
Xue__Feng
正在西安电子科技大学攻读硕士研究生
展开
专栏收录文章
- 默认排序
- 最新发布
- 最早发布
- 最多阅读
- 最少阅读
-
python_网络爬虫_urllib
1.域名与IP地址 “ 域名----->DNS服务器------>IP地址” 你的电脑先把域名传给DNS服务器,通过DNS服务器找到域名所对应的IP地址,在传回你的电脑进行访问。 2.调用urllib进行爬取 #读取数据 import urllib f = urllib.urlopen("http://www.baidu.com") print(f.read()) #读取状态 pr...原创 2019-09-05 20:38:28 · 155 阅读 · 1 评论 -
python_网络爬虫_正则化选取信息
1.安装正则化模块re 2.调用正则提取想要的信息 import urllib import re response = urllib.urlopen("http://www.douyu.com") msg = response.read() img = re.findall(r'src="(.*?\.(png|jpg))"',html) 3.下载所有图片 #接续上面的程序 import tim...原创 2019-09-05 21:13:08 · 555 阅读 · 0 评论 -
python_网络爬虫_urllib2
1.URL变化应对 #这里应用urlencode把变化对应的值添加到字典里,然后再加到URL上 import urllib inf = urllib.urlencode({"w":"python","b":"t"}) f = urllib.urlopen("http://www.baidu.com%s"%inf) 2.get与post #get方式 urllib.urlopen("http://...原创 2019-09-05 22:22:49 · 208 阅读 · 0 评论 -
python_网络爬虫_beautifulsoup
1.安装beautifulsoup 下载地址:http://pypi.python.org/pypi/beautifulsoup4/4.3.2 官方文档:http://beautifulsoup.readthedocs.org/zh-CN/latest 解压安装包:tar zxvf beautifulsoup4-4.3.2.tar.gz 进入解压后文件夹安装:python3 setup.py i...原创 2019-09-06 13:06:39 · 165 阅读 · 0 评论
分享