摘要: 1.验证码是门户网站的反爬机制 (1)反爬机制:验证码:识别验证码图片中的数据,用于模拟登陆。 (2)识别验证码的操作: -人工肉眼识别(肉眼识别) - 第三方自动识别(推荐方式) 阅读全文
posted @ 2022-08-14 10:17 机械猿 阅读(102) 评论(0) 推荐(0)
摘要: 1.环境安装: -pip install lxml 2.如何实例化一个etree对象: from lxml import etree(1)将本地的html文档中的源码数据加载到etree对象中: etree.parse(filePath) (2)可以将从互联网上获取的源码数据加载到etree对象中: 阅读全文
posted @ 2022-08-14 10:16 机械猿 阅读(73) 评论(0) 推荐(0)
摘要: 1.requests模块介绍: python中原生的一款基于网络请求的模块,功能非常强大,简单便捷,效率极高; 作用:模拟浏览器发送请求 如何使用:(requests模块的编码流程) - 指定url - 发起请求(get,post) -获取相应数据 - 持久化存储(获取的是一个页面) 阅读全文
posted @ 2022-08-07 21:34 机械猿 阅读(66) 评论(0) 推荐(0)
摘要: 1.BeautifulSoup对象使用 form bs4 import BeautifulSoup 2.对象的实例化: - 1.将本地的html文档中的数据加载到该对象中 fp = open('./test.html','r',encoding = 'utf-8') soup = Beatifuls 阅读全文
posted @ 2022-07-31 16:46 机械猿 阅读(47) 评论(0) 推荐(0)
摘要: 1.爬虫在使用场景中的分类 (1)通用爬虫 抓去系统的重要组成部分,抓去的是一整张页面的数据 (2)聚焦爬虫 是建立在通用爬虫的基础上,抓取页面上的指定的局部内容 (3)增量式爬虫 检测网站中数据更新情况,只抓取网站中最新更新出来的数据 2.robots.txt协议: 明确规定网站中那些数据可以被爬 阅读全文
posted @ 2022-07-30 10:55 机械猿 阅读(52) 评论(0) 推荐(0)
摘要: 1.深度查询: def index(request): name = "root" age = 13 sex = True lve = ["swimming","shopping","coding",] bookinfo = {"id":10,"price":9.0} return render(r 阅读全文
posted @ 2022-06-28 23:21 机械猿 阅读(37) 评论(0) 推荐(0)
摘要: 1.成员:绑定,类,静态方法: class Foo(object): def __init__(self,name,age): self.name = name self.age = age def f1(self): print("绑定方法",self.name) @classmethod def 阅读全文
posted @ 2022-06-11 19:03 机械猿 阅读(45) 评论(0) 推荐(0)
摘要: 1.表单标签: <form>action= " " method= " " enctype = " 表单域"</form>属性:action:表示访问服务器的地址enctype: application/x-www-form-urlencodec[默认值] 格式:"num=1&num2=2" mul 阅读全文
posted @ 2022-05-10 07:56 机械猿 阅读(88) 评论(0) 推荐(0)
摘要: 1.表格的使用 <table>表示表格的开始与结束 <tr>表示第一行的开始与结束 <tb>表示表格终得第一个单元格的开始与结束 #表格的结构 <table broder = "1"> <tr> <tb></tb> </tr> </table> broder:表示表格的边框 table的属性: tb 阅读全文
posted @ 2022-05-08 18:40 机械猿 阅读(105) 评论(0) 推荐(0)
摘要: 1.无序标签 <ul type = "square"> <li>item1</li> <li>item2</li> <li>item3</li> </ul> 2.有序标签(显示排列数字) <ol start = "100"> <li>item1</li> <li>item2</li> <li>ite 阅读全文
posted @ 2022-05-08 18:05 机械猿 阅读(30) 评论(0) 推荐(0)