Python进阶训练营(一)(视频代码齐)

Python进阶训练营(一)(视频代码齐) 网盘download:Python进阶训练营 提娶马:uuiy 课程介绍、学习方法与简单爬虫 01 课程介绍 02 绪论 03 提高Python 开发效率的工具 04 复习Python 的基础语法 05 使用Python 库获取豆瓣影评和书评html

学习目标 掌握高效系统学习Python 的方法 提高Python 开发效率的工具 复习基础Python 语法前端

01 课程介绍python

  1. 完整案例:NLP 舆情系统

需求描述-数据收集-数据处理-语料处理-深度学习-结果测评-调参-展现 2. Python 底层功能 做用域问题 面向对象编程 多线程、协程 爬虫框架、Web 框架 课程介绍shell

02 绪论 为什什么学习Python编程

  1. Python 语言足够流行
  2. Python 语言足够“简单”
  3. 生态完善

Python 做为第⼆二语⾔言windows

  1. 做为第⼆二语⾔言能够作知识迁移
  2. 前端开发能够从爬⾍虫项⽬目开始⽆无痛⼊入⼿手
  3. 后端开发能够对⽐比静态语⾔言和动态语⾔言的差别

高效学习Python 的方法后端

  1. 建⽴立⾼高效的学习模型
  2. 了了解Python 的⻓长处
  3. 了了解Python 的特性
  4. 多看⾼高⼿手的代码(GitHub)
  5. 好的问题是成功的⼀一半(Google、Stack Overflow)
  6. ⻛风格指引(PEP八、Google Python Style Guides)

03 提高Python 开发效率的工具markdown

提高Python 开发效率的工具多线程

  1. Visual Studio Code:高效的IDE
  • pylint
  • autopep8
  • remote- ssh
  1. Python3.6 or Python3.7:不一样的版本差异在哪里?
  2. Jupyter Notebook:数据科学家的最爱

从一个需求开始 获取豆瓣读书Top 250 的书籍名字和评分app

实现步骤:

  1. F12 调试模式分析网页源代码
  2. 用Requests 爬取网页所有内容
  3. 用Beautiful Soup 解析网页提取关键信息
  4. 用csv 文件存储书籍名字和评分

pip 安装加速 国内常见的镜像站: 豆瓣 清华 升级pip: 方法一: pip install - i pypi.tuna.tsinghua.edu.cn/simple pip -U 方法二: pip config set global.index- url pypi.doubanio.com/simple/pip install pip -U

pip 安装加速 配置文件: windows: c:\Users\xxx\pip\pip.ini Linux: ~/.pip/pip.conf 配置文件格式: [global] index- url = pypi.tuna.tsinghua.edu.cn/simple

翻页都是怎么作到的 search.bilibili.com/all?keyword… search.douban.com/book/subjec… weibo.com/a/aj/transf… weibo.com/a/aj/transf…

格式化字符串 三种经常使用的格式化字符串方式:

  1. % 操做符
  2. str.format(*args, **kwargs)
  3. f- string:Python 3.6 引入,该方法源于PEP498

格式化字符串 % 操做符- - printf 风格的字符串格式化 import math print('The value of Pi is approximately %5.3f.' % math.pi)

输出:The value of Pi is approximately 3.142.

.format - - 更加灵活 print('{1} and {0}'.format('spam', 'eggs’))

输出: eggs and spam

print('The story of {0}, {1}, and {other}.'.交流V(cmL46679910)format('Bill', 'Manfred', other='Georg'))

输出:The story of Bill, Manfred, and Georg.

参考: docs.python.org/zh- cn/3.6/library/string.html#formatstrings f- string:Python 3.6 引入,该方法源于PEP 498。 docs.python.org/zh-cn/3.6/w… f- string 和%操做符、.format 比较:

  1. 性能更好
  2. 易读性好

三种写法比较 firstname = 'yin' lastname = 'wilson' print('Hello, %s %s.' % (lastname, firstname)) print('Hello, {1} {0}.'.format(firstname, lastname)) print(f'Hello, {lastname} {firstname}.') f- string还能够作其余事情: f'{ 2 * 5 }' class Person: def init(self, first_name, last_name): self.first_name = first_name self.last_name = last_name def str(self): return f'hello, {self.first_name} {self.last_name}.' def repr(self): return f'hello, {self.first_name} {self.last_name}.' me = Person('yin', 'wilson') print(f'{me}')

04 复习Python 基础知识 赋值使用“=”符号 Python 3.8会引入海象运算符“:=” (PEP572) 赋值前不须要指定类型(分配内存) 数值、布尔、字符串、序列赋值前不须要指定类型(分配内存)

image.png

image.png Python 的执行方法: shell> python filename.py Python 会将.py 文件编译成字节码pyc 格式文件,由Python 虚拟机执行 shell> python (回车) python>交流V(cmL46679910) import whatyouwant python> run python something 交互模式(解释模式)

总结:

  1. 经过静态页面爬虫复习了Python 的基础语法
  2. 了解Python 语言做为动态语言的特色
  3. 掌握静态页面数据收集的通常方法
相关文章
相关标签/搜索