![](https://img-blog.csdnimg.cn/20201014180756926.png?x-oss-process=image/resize,m_fixed,h_64,w_64)
爬虫
zhangt766
这个作者很懒,什么都没留下…
展开
-
爬虫乱码问题
趁周末爬了下小说,代码如下:import requestsfrom bs4 import BeautifulSoup#需求:爬取三国演义小说所有的章节标题和章节内容http://www.shicimingju.com/book/sanguoyanyi.htmlif __name__ == "__main__": #对首页的页面数据进行爬取 headers = { 'User-Agent': 'Mozilla/5.0 (Macintosh; Intel Mac OS原创 2021-12-05 12:00:26 · 407 阅读 · 0 评论 -
requests关于Exceeded 30 redirects
写了几行平平无奇的代码,想要获取json数据import requestsurl=‘https://image.baidu.com/search/acjson?tn=resultjson_com&logid=10924524703716171320&ipn=rj&ct=201326592&is=&fp=result&queryWord=%E9%87%91%E5%9F%8E%E6%AD%A6&cl=2&lm=-1&ie=utf-原创 2021-10-30 22:13:46 · 1662 阅读 · 0 评论 -
自定义包和系统包重名,导致解释器找不到系统包:ModuleNotFoundError: No module named ‘http.client‘; ‘http‘ is not a package
爬虫遇到一个弱智又好笑的问题代码是:import urllib.requesturl='https://www.lingdianshuwu.com/'resp=urllib.request.urlopen(url)html=resp.read()看起来超级简单吧,然而。。。。报错了。。。原因是左侧命名了一个http文件,request包内部运行的时候会调用http.client包,但是自己命名的工程包也也叫http,导致了系统不知道找哪个好,所以就报错不存在。解决方式..原创 2021-10-28 22:26:01 · 704 阅读 · 2 评论