我的账户
啄木鸟学院

专注软件测试菁英教育

亲爱的游客,欢迎!

已有账号,请

如尚未注册?

python_代金鑫_2021.01.28

[复制链接]
心向未来学员认证 发表于 2021-1-28 20:15:09 | 显示全部楼层 |阅读模式 打印 上一主题 下一主题
今天学习内容 9:00-17:30
文本处理:标题 段落<p></p> 有序列表ol  无序列表ul
分区元素: 块元素
<div>
        <p>马上要吃午饭了</p>   <!-- 自带间距 -->
    </div>
    <div>
        中午盒饭
    </div>
    <div>
        <!--行内元素,不不占一行-->
        <space>米饭</space>
        <space>鸡腿</space>
        <p>今天是个<span>好</span>天气</p>
    </div>
</body>
图片和超链接:
<img src = "赵丽颖.jpg" alt="赵丽颖" width="500">   <!--width设置图片大小  -->
    <hr>
    <!-- 超链接 -->
    <a href="https://www.baidu.com/">百度</a>
    <hr>
    <a href="https://baike.baidu.com/item/%E8%B5%B5%E4%B8%BD%E9%A2%96/10075976?fr=aladdin">
    <img src="赵丽颖.jpg" alt="赵丽颖" width="200">
</a>
表格:<table border="1px" cellspacing="0" cellpadding='0'>
        <!-- 一行 -->
        <tr>
            <!-- 3列 -->
            <td>aaa</td>
            <td>bbb</td>
            <td>ccc</td>
        </tr>
        <tr>
            <td>AAA</td>
            <td>BBB</td>
            <td>CCC</td>
        </tr>
        <tr>
            <td colspan="3">ggg</td>
        </tr>
</table>
表单:
<form action="https://www.baidu.com">
        <!--
            account =admin password= 123456
         -->
        账户: <input type='text' name='account'/>
        <br><br>
        <!-- 密码 -->
        密码: <input type='password' name='password'>
        <br><br>
        <input type="submit" value="注册">
        <hr>
        <!-- 单选 -->
        性别: <input type="radio" name='gander' id="" >男
            <input type="radio" name='gander' id="" >女
        <br><br>
        <!-- 多选 -->
        爱好: <input type='checkbox' name='hobby'>游戏
                <input type='checkbox' name='hobby'> 宅家
                <input type='checkbox' name='hobby'> 美食
                <input type='checkbox' name='hobby'> 睡觉
        <br><br>
        城市:
        <!-- 下拉选择框 -->
            <select name='city' id="">
                <option  value='0'>-请选择-</option>
                <option  value='1'>西安</option>
                <option  value='2'>咸阳</option>
                <option  value='3'>宝鸡</option>
            </select:>
        <br><br>
        日历:
            <input type='date' name='hobby'>日期
</form>
# 将爬虫伪装成浏览器
headers = {'User-Agent': 'Mozilla/5.0 (Windows NT 6.1; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/87.0.4280.88 Safari/537.36'}
# 使用get方法发出请求,然后接受响应
r = requests.get('https://baidu.com',headers=headers)
# 设置编码集
r.encoding = 'utf-8'
# 将字符串格式的网页转别成etree格式
selector = etree.HTML(r.text)
# 获取图片地址  定位元素
# print(r.text)   # 打印结果 <Response [200]>对象
href = selector.xpath('//*[@id="s_lg_img"]/@src')[0]
# d = requests.get('https://www.douban.com/',headers=headers)
# d.encoding = 'utf-8'
# print(d.text)
# 下载图片
response = requests.get('https:'+href)
with open('long.png','wb') as file:
    file.write(response.content)
# print(response.content)
                          
18:20~20:30  整理笔记,对今天所学内容进行回顾复习

回复

使用道具 举报

关注0

粉丝0

帖子23

发布主题
大家都在学
课堂讨论
一周热帖排行最近7x24小时热帖
关注我们
专注软件测试菁英教育

客服电话:17792550360

客服时间:9:00-21:00

卓目鸟学苑 - 专注软件测试菁英教育!( 陕ICP备2025058934号-2 )

版权所有 © 西安菁英教育科技有限公司 2023-2026