Day1 前端基础(爬虫)
一、常用标签1
<!DOCTYPE html>
<html>
<head>
<meta charset="utf-8" />
<title>网页标题--WX</title>
<link rel="icon" type="image/jpg" href="./img/JD图标.jpg"/>
</head>
<body>
你好,世界!
<h1>一级标题</h1>
<h2>二级标题</h2>
<h3>三级标签</h3>
<h4>四级标签</h4>
<h5>五级标签</h5>
<h6>六级标签</h6>
<p>这一天一天的</p>
<p>这两天两天的</p>
<p>这三天三天的水电费付付付付付付付付付付付付付付付付付发生的,
口号卡拉的拉卡拉卡克拉里看见俺老家的客流量卡,等级案件收到了加快劳动节拉开建档立卡看了的金坷垃就立刻就打啦阿昆达捡垃圾山莨菪碱阿拉山口讲道理卡时间段开辣椒水鹿鼎记奥克兰 奥地利会计案例肯德基拉科技的卡拉建档立卡家里肯德基埃里克</p>
<span>发布时间:2021 0524</span>
<span>王新</span><br>
<font>发布时间:2021 0524</font>
<font>王新</font>
<p><b><i> 静夜思</i></b><br>
床前明月光,<br>
 疑似地上霜。<br>
举头望明月,<br>
低头思故乡。
</p>
</body>
</html>
二、常用标签2
<!DOCTYPE html>
<html>
<head>
<meta charset="utf-8">
<title>常用标签2</title>
</head>
<body>
<img src="./img/JD图标.jpg" title="图片1">
<img src="https://dss0.bdstatic.com/70cFuHSh_Q1YnxGkpoWK1HF6hhy/it/u=2496571732,442429806&fm=26&gp=0.jpg" title="图片2" >
<img src="https://dss0.bdstatic.com/70cFuHSh_Q1YnxGkpoWKF6hhy/it/u=2496571732,442429806&fm=26&gp=0.jpg" title="图片2" alt='图片加载失败' >
<a href="https://www.baidu.com" target="_blank">百度</a>
<a href="https://www.jd.com"><img src="./img/JD图标.jpg" title="图片1"></a>
</body>
</html>
三、表单相关标签
<!DOCTYPE html>
<html>
<head>
<meta charset="utf-8">
<title>表单标签</title>
</head>
<body>
<form action="" method="">
</form>
<form action="" method="">
普通的文本输入框:<input type="text" id='username' value="小明" placeholder="请输入手机号码" maxlength="10"/><br>
密码输入框:<input type="password" value="123456" placeholder="请输入密码"/><br>
普通按钮:<input type="button" value="确定"/><br>
单选按钮:<input type="radio" value='男'/><br>
单选按钮:<input type="radio" id='sex1' name='sex' checked="checked"/><label for="sex1" >男</label>
<input type="radio" id='sex2' name='sex'/><label for='sex2' >女</label><br>
复选按钮:<input type="checkbox" id='ball1' name="ball"/><label for="ball1">篮球</label>
<input type="checkbox" id='ball2' name="ball"/><label for="ball2">足球</label>
<input type="checkbox" id='ball3' name="ball"/><label for="ball3">羽毛球</label>
<input type="checkbox" id='ball4' name="ball"/><label for='ball4'>乒乓球</label><br>
重置按钮:<input type="reset" value='还原'/><br>
</form>
颜色选择器:<input type="color"/><br>
文件选择:<input type="file" /><br>
时间选择器:<input type="datetime-local"/><br>
日期选择器:<input type="date"/><br>
</body>
</html>
四、表单相关标签2
<!DOCTYPE html>
<html>
<head>
<meta charset="utf-8">
<title>表单相关标签2</title>
</head>
<body>
<textarea rows="4" cols="100" placeholder="请输入内容...">小明</textarea>
<br>
<select name="city">
<option value="成都市">成都市</option>
<option value ="达州市">达州市</option>
<option value ="绵阳市">绵阳市</option>
<option value ="南充市">南充市</option>
<option value ="眉山市">眉山市</option>
<option value ="乐山市">乐山市</option>
</select>
<ol>
<li>Python</li>
<li>java</li>
<li>h5</li>
<li>UI</li>
<li>物联网</li>
</ol>
<ul>
<li>Python</li>
<li>java</li>
<li>h5</li>
<li>UI</li>
<li>物联网</li>
</ul>
</body>
</html>
五、requests的使用
import requests
from re import *
response = requests.get('https://www.sohu.com/')
response.encoding = 'utf-8'
if response.status_code == 200:
str1 = response.text
result = findall(r'<a.*?href=".*?".*?title=[\'"].*?[\'"].*?>', str1)
for x in result:
result1 = findall(r'href=".*?"', x)
result2 = findall(r'title=[\'"].*?[\'"]', x)
print(f'标题:{str(result2)[9:-3]} 链接:{str(result1)[8:-3]}')