# PracticePython **Repository Path**: SteveRocket/practice_python ## Basic Information - **Project Name**: PracticePython - **Description**: 主要基于Python3.11。涉及Python开发技巧、特性、性能调优、底层原理、内置库、内置方法、网络编程、设计模式、数据结构和算法、安全编程、开发框架、自动化测试框架、机器学习、科学计算、开发规范等知识点总结。 - **Primary Language**: Python - **License**: Not specified - **Default Branch**: master - **Homepage**: https://gitee.com/SteveRocket/ - **GVP Project**: No ## Statistics - **Stars**: 5 - **Forks**: 3 - **Created**: 2022-11-14 - **Last Updated**: 2025-03-17 ## Categories & Tags **Categories**: Uncategorized **Tags**: practice ## README # ABOUT **【关于我们】** * [Articulate v1.0](https://mp.weixin.qq.com/s/0yqGBPbOI6QxHqK17WxU8Q) * [Articulate v2.0](https://mp.weixin.qq.com/s/V5Axn-ZWi22ubh5Jiocb9g) [![](https://img.shields.io/badge/GitHub-zrf--rocket-blue?logo=gitpod)](https://github.com/zrf-rocket) [![](https://img.shields.io/badge/Gitee-SteveRocket-pink)](https://gitee.com/SteveRocket/) ![CTO Plus](https://img.shields.io/badge/微信公众号:CTO%20Plus-8A2BE2) 🥰 ## Contact ![微信公众号](./static/wechat.png) **< 微信公众号 >** ![QQ技术交流群](./static/qq_link.png) **< QQ技术交流群 >** ![联系作者](./static/wechat.jpg) **< 联系作者 >** ## **【代码工程系列】** * [Python和Go的设计模式](https://github.com/zrf-rocket/DesignPattern) * GitHub:https://github.com/zrf-rocket/DesignPattern * Gitee:https://gitee.com/SteveRocket/design_pattern * [Python、Go的编码技巧cookbook](https://github.com/zrf-rocket/CookBook) * GitHub:https://github.com/zrf-rocket/CookBook * Gitee:https://gitee.com/SteveRocket/cook-book * [Go代码示例](https://github.com/zrf-rocket/PracticeGo) * GitHub:https://github.com/zrf-rocket/PracticeGo * Gitee:https://gitee.com/SteveRocket/practice_go * [Python代码示例](https://github.com/zrf-rocket/PracticePython) * GitHub:https://github.com/zrf-rocket/PracticePython * Gitee:https://gitee.com/SteveRocket/practice_python * [Python Web框架的示例代码](https://github.com/zrf-rocket/PythonFramework) * GitHub:https://github.com/zrf-rocket/PythonFramework * Gitee:https://gitee.com/SteveRocket/python_framework * Django:https://github.com/zrf-rocket/PythonFramework/tree/master/django_framework * Flask:https://github.com/zrf-rocket/PythonFramework/tree/master/flask_framework * [Python 爬虫框架和技术](https://github.com/zrf-rocket/PracticeSpider) * GitHub:https://github.com/zrf-rocket/PracticeSpider * Gitee:https://gitee.com/SteveRocket/practice_spider * [Rust代码示例](https://github.com/zrf-rocket/PracticeRust) * GitHub:https://github.com/zrf-rocket/PracticeRust * Gitee:https://gitee.com/SteveRocket/practice_rust * [Vue代码示例](https://github.com/zrf-rocket/PracticeVue) * GitHub:https://github.com/zrf-rocket/PracticeVue * Gitee:https://gitee.com/SteveRocket/practice_vue * [前端代码示例](https://github.com/zrf-rocket/PracticeFronted) * GitHub:https://github.com/zrf-rocket/PracticeFronted * Gitee:https://gitee.com/SteveRocket/practice_fronted * [Python自动化测试框架](https://github.com/zrf-rocket/PythonTestAutomationFramework) * GitHub:https://github.com/zrf-rocket/PythonTestAutomationFramework * Gitee:https://gitee.com/SteveRocket/python_test_automation_framework * [Python和Go的算法代码示例](https://github.com/zrf-rocket/Algorithms) * GitHub:https://github.com/zrf-rocket/Algorithms * Gitee:https://gitee.com/SteveRocket/Algorithms * [Python和Go的数据结构代码示例](https://github.com/zrf-rocket/DataStructure) * GitHub:https://github.com/zrf-rocket/DataStructure * Gitee:https://gitee.com/SteveRocket/data_structure * [编码规范](https://github.com/zrf-rocket/DevGuide) * GitHub:https://github.com/zrf-rocket/DevGuide * Gitee:https://gitee.com/SteveRocket/develop_guide * [编码安全规范](https://github.com/zrf-rocket/SecGuide) * GitHub:https://github.com/zrf-rocket/SecGuide * Gitee:https://gitee.com/SteveRocket/security_guide ## **【产品系列】** * [主机监控系统-日志收集与报警管理系统(SIEM)](https://github.com/zrf-rocket/SIEM) * GitHub:https://github.com/zrf-rocket/SIEM * Gitee:https://gitee.com/SteveRocket/siem * [安全运营中心(SOC)-终端侦测与响应系统(EDR)](https://github.com/zrf-rocket/EDR_SOC) * GitHub:https://github.com/zrf-rocket/EDR_SOC * Gitee:https://gitee.com/SteveRocket/edr_soc * [安全运营中心(SOC)-信息资产采集与安全评估系统(ICSA)](https://github.com/zrf-rocket/SOC_ICSA) * GitHub:https://github.com/zrf-rocket/SOC_ICSA * Gitee:https://gitee.com/SteveRocket/SOC_ICSA * [DevSecTestOps-SDLC-自动化研发安全测试运维一体化平台(DevSecTestOps)](https://github.com/zrf-rocket/DevSecOps-SDLC) * GitHub:https://github.com/zrf-rocket/DevSecOps-SDLC * Gitee:https://gitee.com/SteveRocket/dev-sec-ops-sdlc * [Penetration Test-自动化渗透测试平台(PT)](https://github.com/zrf-rocket/PenetrationTest) * GitHub:https://github.com/zrf-rocket/PenetrationTest * Gitee:https://gitee.com/SteveRocket/penetration_test * [cicd-持续集成持续部署系统(CI/CD)](https://github.com/zrf-rocket/CICD) * GitHub:https://github.com/zrf-rocket/CICD * Gitee:https://gitee.com/SteveRocket/cicd * [AI图像识别-智能缺陷检测系统]() * [基于AI图像识别的工业缺陷检测应用系统(GPU&FPGA)](https://mp.weixin.qq.com/s/04qefQFg-Pg1Gcqq1vBLQQ) * [基于AI图像识别的智能缺陷检测系统,在钢铁行业的应用-技术方案](https://mp.weixin.qq.com/s/dSHbnuOwQZzE4CvPr1JYjg) # Python 主要基于Python3.12。以及Python2/3.6、3.8、3.10、3.11各自版本的特性。这里是Python从零基础到进阶、高级、实战案例的路线维度。对应的技术文章维度可以跳转到[技术路线博客](README_blog.md)。 ## 涉及内容包括 Python概述和主要应用领域 多端开发环境搭建 没有不好的语言,只有用不好语言的开发者。 更加简洁、极致、高效,别让代码显得那么臃肿 更高阶、更函数化 封装技巧:DRY 重构技巧 面向对象 设计模式 算法分析 基本数据结构 递归 排序和搜索 树和树的算法 图和图的算法 #### 虚拟环境 * virtualenv * pipenv * anaconda * 参考文章: #### pip包管理器 * 包名 * pip install package_name * 包文件 * pip install package_name.whl/package_name.tar.gz * 文件包清单 * pip install -r requirements.txt * 添加源 * pip install -r requirements.txt -i resource_url * 参考文章: ### Python2基础特性 ### Python3基础特性 * 内置方法 参考文章: * py2与py3的区别 参考文章: * 编码规范 参考文章: * 安全规范 参考文章: * 代码扫描与编排 参考文章: * 函数
  函数对象是通过函数定义创建的。 对函数对象的唯一操作是调用它: func(argument-list)。
  实际上存在两种不同的函数对象:内置函数和用户自定义函数。 两者支持同样的操作(调用函数),但实现方式不同,因此对象类型也不同。
* 方法
  方法是使用属性表示法来调用的函数。 存在两种形式:内置方法(例如列表的 append() 方法)和类实例方法。 内置方法由支持它们的类型来描述。
  如果你通过一个实例来访问方法(即定义在类命名空间内的函数),你会得到一个特殊对象: 绑定方法 (或称 实例方法) 对象。 当被调用时,它会将 self 参数添加到参数列表。 绑定方法具有两个特殊的只读属性: m.__self__ 操作该方法的对象,而 m.__func__ 是实现该方法的函数。 调用 m(arg-1, arg-2, ..., arg-n) 完全等价于调用 m.__func__(m.__self__, arg-1, arg-2, ..., arg-n)。
  与函数对象类似,绑定方法对象也支持获取任意属性。 但是,由于方法属性实际上保存于下层的函数对象中 (meth.__func__),因此不允许设置绑定方法的方法属性。 尝试设置方法的属性将会导致引发 AttributeError。 想要设置方法属性,你必须在下层的函数对象中显式地对其进行设置:
### Python进阶 #### 推导式 是一种独特的数据处理方式,可以从一个数据序列构建另一个新的数据序列的结构体,支持各种数据结构的推导式: * 列表(list)推导式 * 字典(dict)推导式 * 集合(set)推导式 * 元组(tuple)推导式 #### 错误和异常处理 * 将输出用日志记录到文件中 * 处理多个异常 * 捕获所有异常 * 创建自定义异常 * 捕获异常后抛出另外的异常 * 重新抛出最后的异常 * 输出警告信息 * 调试基本的程序崩溃错误 参考文章: ### 标准库 ### 内置函数 ### Python高级特性 ### Python开发技巧 ### Python源码剖析 ### Python设计模式 ### Python数据结构 ### Python安全编程 ### 操作系统编程详解与实战 #### Windows编程 #### Linux编程 #### 代码打包与编译发布 ### 标准库详解与实战 ### 第三方库详解与实战 ### Python Web开发框架大全 #### Django * 开发常用的第三方库 #### Flask * 开发常用的第三方库 #### Tornado * 开发常用的第三方库 ### 性能分析与调优 ### 底层原理 ### OOP面向对象编程 ### 数据库 #### MySQL #### Redis #### MongoDB #### MySQL #### PostgreSQL #### Elasticsearch ### 中间价 ### 网络编程 ### 网络编程之爬虫 ### Python算法 ### 自动化测试框架 ### 机器学习 ### 科学计算 ### 代码加速 ### 代码打包发布 ## 目录结构 * DatabaseProgram 数据库编程 * NetworkProgram 网络编程 * OOP 面向对象编程 * [inner_module_def_datastruct 内置模块、内置函数、内置数据结构](./inner_module_def_datastruct/README.md) * inner_constant 内置常量 * inner_datastruct 内置数据结构 * inner_def 内置函数 * inner_except 内置异常 * inner_module 内置模块 * inner_type 内置类型 * FeaturesVersion 不同版本的Python新增的特性 * py2pro Python2功能特性代码 * py3pro Python3常规功能代码 * 3.8ch Python3.8的新特性 * 3.10ch Python3.10的新特性 * 3.11ch Python3.11的新特性 * 3.12ch Python3.11的新特性 * 3.13ch Python3.11的新特性 * PerformanceImplementation Python高级 * development_skills 开发技巧 * implementation 实现原理 * performance 性能特性 * third_party_library 第三方库 * pr_airflow * pr_apscheduler * pr_celery * pr_consul * pr_elasticsearch * pr_influxdb-client * pr_kafka * pr_mysql * pr_open_cv * pr_redis * pr_sqlarchmy * pr_whatchdog * pr_pyaudio * pr_jsonschema * pr_pyaudio * pr_arrow * [sklearn](https://www.sklearncn.cn) ## 引申 * [Python常用的主流Web开发框架 Python Framework](https://gitee.com/SteveRocket/python_framework) * [Python常用的自动化测试框架 Python Automation(Unittest) Framework](https://gitee.com/SteveRocket/python_test_automation_framework) * [Python各版本特性标准库文档](https://docs.python.org/zh-cn/3)