![](https://img-blog.csdnimg.cn/20201014180756913.png?x-oss-process=image/resize,m_fixed,h_64,w_64)
爬虫
cgl_dong
!
展开
-
Python爬虫resquests模块简单使用
本次爬虫使用requests模块爬取信息,使用BeautifulSoup4解析页面,爬取csdn首页,并解析出部分内容,并存入本地文件。一、requests模块1、简介requests是使用Apache2 licensed 许可证的HTTP库。用python编写。比urllib2模块更简洁。Request支持HTTP连接保持和连接池,支持使用cookie保持会话,支持文件上传,支持...原创 2019-07-13 22:28:12 · 3125 阅读 · 1 评论 -
爬虫乱码UnicodeEncodeError: ‘gbk’ codec can’t encode character ‘\xa0’ in position
在Python中将网址写入文件的时候,会碰到:UnicodeEncodeError: ‘gbk’ codec can’t encode character ‘\xa0’ in position 0这个问题。其实就是在windows中,新建的文本文件的默认编码是gbk.1、我们需要更改一下编码方式:如with open("F:\\1.html","w",encoding="utf-8") a...原创 2019-07-16 20:47:18 · 707 阅读 · 0 评论