如何做网站弹窗,毕节做网站优化,自适应网站建设模板,白云区手机版网站建设爬虫
爬虫是什么#xff1f; spider 是一种模仿浏览器上网过程的一种程序#xff0c;可以获取一些网页的数据 基础知识
URL 统一资源定位符 uniform resource locator http: 超文本传输协议 HyperText Transfer Protocol 默认端口 80 https: 安全的超文本传输协议 security…爬虫
爬虫是什么 spider 是一种模仿浏览器上网过程的一种程序可以获取一些网页的数据 基础知识
URL 统一资源定位符 uniform resource locator http: 超文本传输协议 HyperText Transfer Protocol 默认端口 80 https: 安全的超文本传输协议 security 默认端口 443 www.example.com 域名 80 端口 port /path/to/myfile.html 资源路径 ?key1value1key2value2 参数 表示多个参数的拼接 # 锚点 前端代码
!DOCTYPE html 声明为 HTML5 文档
html../html 是网页的根元素
head../head 元素包含了文档的元meta数据如 meta charsetutf-8 定义网页编码格式为 utf-8。
title..title 元素描述了文档的标题
body../body 表示用户可见的内容
div../div 表示框架
p../p 表示段落
ul../ul 定义无序列表
ol../ol定义有序列表
li../li表示列表项
img src alt表示图片
h1../h1表示标题
a href../a表示超链接!DOCTYPE html
htmlhead!-- 内嵌样式 --style typetext/cssbody{background-color:yellow;}p{font-size: 30px;color: springgreen;}/stylemeta charsetutf-8title兰智数加学院/title/headbodya hrefwww.anhuisjxy.com点击访问/ah1兰智数加www.anhuisjxy.com/h1h2Python爬虫/h2divp认识网页结构/pulliHTML/liliCSS/li/ul/div/body
/html!DOCTYPE html
htmlheadstyle typetext/cssbody{background-color: rgb(220, 226, 226);}/stylemeta charsetutf-8title兰智数加学院/title/headbodyh1 stylecolor: blue;兰智数加www.anhuisjxy.com/h1h2Python爬虫/h2p点击下方按钮获取当前时间/pbutton onclickDisplayDate()点击这里/buttonp idtime stylecolor: red;/p!-- script标签内部编写js代码 --scriptfunction DisplayDate(){document.getElementById(time).innerHTMLDate()}/script/div/body
/html爬虫代码
安装requests包
pip install requestspip 换源
pip config set global.index-url https://pypi.mirrors.ustc.edu.cn/simple/
pip config set install.trusted-host pypi.mirrors.ustc.edu.cnUser-Agent 身份标识 表示你是哪个浏览器