![](https://img-blog.csdnimg.cn/20201014180756754.png?x-oss-process=image/resize,m_fixed,h_64,w_64)
Python爬虫
爬虫小项目
是欧欧啊
这个作者很懒,什么都没留下…
展开
-
练习2_小图片下载源码
练习2_小图片下载源码import urllib.requestfrom urllib import requestfrom bs4 import BeautifulSoupn=1#1.获取网页源代码url = 'https://www.duitang.com/search/?kw=%E6%98%93%E7%83%8A%E5%8D%83%E7%8E%BA&type=feed'def crawl(url): #避免反爬 伪装 浏览器信息 headers = {原创 2020-11-04 12:01:07 · 237 阅读 · 0 评论 -
练习1_小作文下载源码
练习1_小作文下载源码import requestsfrom lxml import etree# 1.网页源代码def getlist(): url = requests.get('https://www.chnlib.com/zuowenku/') #.content.decode('utf-8') html = url.content.decode('utf-8')# print(str)# getlist()#2.获取每一个篇章的超链接 doc =原创 2020-11-04 11:52:25 · 283 阅读 · 0 评论 -
Python爬虫练习2_小图片下载
图片下载准备工具前言步骤分析与代码实现准备工具本机环境:Windows10专业版操作系统:64位Python版本:python 3.8运行工具:Python 3.8.0 Shell前言今天有点难,因为我的PyCharm体验到期了,运行工具就用python3.8自带的IDLE(好的coder要学废用各种工具!)步骤分析与代码实现开始之前先导入一些库import urllib.requestfrom urllib import requestfrom bs4 import Beaut原创 2020-10-30 11:57:12 · 877 阅读 · 0 评论 -
Python爬虫练习1_小作文下载
作文下载准备工具步骤分析与代码实现准备工具本机环境:Windows10专业版操作系统:64位Python版本:python 3.8运行工具:PyCharm 2020.2步骤分析与代码实现获取网页源代码url = requests.get('https://www.chnlib.com/zuowenku/')html = url.content.decode()#对乱码处理,这里没写内容默认值就是‘UTF-8’print(str)获取作文篇章的url构造一个xpath用原创 2020-10-19 14:34:30 · 838 阅读 · 5 评论