Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

示例:【G20200343030189-Week 03】学习总结 #1

Open
kelly422 opened this issue Feb 27, 2020 · 2 comments
Open

示例:【G20200343030189-Week 03】学习总结 #1

kelly422 opened this issue Feb 27, 2020 · 2 comments

Comments

@kelly422
Copy link
Contributor

kelly422 commented Feb 27, 2020

标题格式:【学号+Week 03】(如果是第二周就是Week 02,以此类推)+文章标题

正文部分,字数不限。

@kelly422 kelly422 changed the title 示例:【0189-Week 03】学习总结 示例:【G20200343030189-Week 03】学习总结 Feb 27, 2020
@jackyPang10086
Copy link
Contributor

[TOC]

学习总结

第一节

  • 从基础开始学习了如何爬取一个网站
  • 爬取网站基本思路:
    • 获取网页源代码-->requests包(实现http协议)
    • 用过滤规则提取关键信息-->beautiful soup包,或者Xpath定位,或者用正则表达式匹配
    • 将爬取到的数据存储到本地.-->csv方式,或者用pandas
  • tips:
    • 访问方式有三种:get, post, cookie
    • pip下载的时候要更换源
    • f-string 格式化字符串
    • type() 查看数据类型

第二节

  • 了解tcp协议
  • http协议与浏览器:
    • 发起响应的过程:
    • 用户发起请求,http解析
    • 解析完成,返回数据包
  • Xpath搜寻节点:
    • / 根节点
    • // 任意节点
    • . 当前节点
    • .. 当前父节点
    • @ 选取属性
  • selenium 来模拟用户登录

第三节

  • 变量和作用域:
    • LEGB
    • Local 函数或者类方法 内部
    • Enclosed 嵌套在函数内
    • Global 全局
    • Built-in 內建命名空间
  • 基本数据类型的课表类型与不可变类型
    • 不可变传对象,可变传对象引用
  • 深拷贝与浅拷贝:
    • 区别:是否真正获取一个对象的实体
    • 浅拷贝(shallowCopy)只是增加了一个指针指向已存在的内存地址.(引用)
    • 深拷贝(deepCopy)是增加了一个指针并且申请了一个新的内存,使这个增加的指针指向这个新的内存.(重新开辟空间)
  • 序列:
    • 扁平序列:只能容纳一种数据类型-->字符串
    • 容器序列:可以存放不同的数据类型-->列表,元组
  • 推导式:
    • 构建列表,字典,集合和生成器的便捷方式
    • 语法: [ 表达式 for 迭代变量 in 可迭代对象 if条件 ]
  • 函数的可变参数
  • Lambda表达式
  • 高阶函数
    • 偏函数:传递参数,需要固定一个参数,可以被闭包实现

总结:

一周下来,收获很大,学到很多,真心感觉Python不简单,还得多写代码.

@jackyPang10086
Copy link
Contributor

【G20200389010054-Week 01】学习总结

kelly422 pushed a commit that referenced this issue Mar 12, 2020
kelly422 pushed a commit that referenced this issue Mar 12, 2020
kelly422 pushed a commit that referenced this issue Mar 19, 2020
kelly422 pushed a commit that referenced this issue Mar 19, 2020
提交week02作业前更新代码
kelly422 pushed a commit that referenced this issue Mar 19, 2020
kelly422 pushed a commit that referenced this issue Mar 19, 2020
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants