Python Quick Programming Primer
Tags
Summary
Editor's review
Who it's for
A good fit for
- Absolute beginners with no programming experience who want to find a clear learning path.
- Enthusiasts interested in Python but intimidated by the complex theories in other textbooks, eager to quickly get started and write practical code.
- Non-computer-major students or professionals who need to master Python basic syntax in a short time to handle simple automation tasks in study or work.
- Learners who prefer clear structure, case-driven content, and straightforward explanations.
Not a good fit for
- Developers who already have a foundation in Python or other programming languages and seek deeper understanding of advanced features, design patterns, or underlying mechanisms.
- Readers who expect to master Python through a single book and apply it to complex project development.
Reading tips
- It is recommended to study strictly in chapter order and be sure to practice every sample code hands-on; acquiring programming skills is inseparable from repeatedly hitting the keyboard.
- After understanding the basic syntax, try modifying and extending the small cases in the book; this is a key step for consolidating knowledge and developing problem-solving ability.
- After completing this book, it is recommended to immediately plan a small practical project (such as automating Excel spreadsheets or scraping specific web page information), fill gaps through practice, and naturally transition to more systematic learning materials.
About the publisher
Posts & Telecom Press is known for its strengths in science and technology, computing, and information and communications titles, and has extended its publishing into photography, art, software learning, and inspirational growth, giving it a fairly diverse range. Its catalog includes computing and communications works such as Refactoring and Patterns (Revised Edition) and Huawei Switch Learning Guide (Second Edition), alongside bilingual collector's editions such as The Little Prince (Chinese-English-French illustrated collector's edition), The Great Gatsby, and Three Days to See. Beijing Ten Years: 1980-1990 and Ghost Blade: WLOP Personal Illustration Collection reflect its presence in photography and art. Its authors include Antoine de Saint-Exupéry, Helen Keller, Joshua Kerievsky, Wang Da, Zhang Zhaozeng, and WLOP.
Contents
- 版权信息
- 内容提要
- 序言
- 前言
- 第1章 Python概述
- 1.1 认识Python
- 1.1.1 Python的发展历程
- 1.1.2 Python的特点
- 1.1.3 Python的应用领域
- 1.1.4 Python的版本
- 1.1.5 Python 2.x和Python 3.x版本区别
- 1.2 Python安装
- 1.2.1 Windows安装Python开发环境
- 1.2.2 Linux安装Python开发环境
- 1.2.3 Mac OS安装Python开发环境
- 1.3 IPython——交互式解释器
- 1.4 集成开发环境——PyCharm
- 1.4.1 PyCharm的下载安装
- 1.4.2 PyCharm的使用
- 1.5 Python程序执行原理
- 1.6 本章小结
- 1.7 本章习题
- 第2章 Python基础语法
- 2.1 基本语法
- 2.1.1 注释
- 2.1.2 行与缩进
- 2.1.3 语句换行
- 2.2 变量和数据类型
- 2.2.1 变量和赋值
- 2.2.2 变量的类型
- 2.3 标识符和关键字
- 2.3.1 标识符
- 2.3.2 关键字
- 2.4 简单数值类型
- 2.4.1 整型
- 2.4.2 浮点型
- 2.4.3 布尔类型
- 2.4.4 复数类型
- 2.4.5 数字类型转换
- 2.5 运算符
- 2.5.1 算术运算符
- 2.5.2 赋值运算符
- 2.5.3 复合赋值运算符
- 2.5.4 比较运算符
- 2.5.5 逻辑运算符
- 2.5.6 成员运算符
- 2.6 位运算
- 2.6.1 按位左移
- 2.6.2 按位右移
- 2.6.3 按位与
- 2.6.4 按位或
- 2.6.5 按位异或
- 2.6.6 按位取反
- 2.7 运算符优先级
- 2.8 本章小结
- 2.9 本章习题
- 第3章 Python常用语句
- 3.1 判断语句
- 3.1.1 if语句
- 3.1.2 if-else语句
- 3.1.3 if-elif语句
- 3.1.4 if嵌套
- 3.1.5 if案例——猜拳游戏
- 3.2 循环语句
- 3.2.1 while循环
- 3.2.2 for循环
- 3.2.3 while循环案例——计算 1~100 偶数和
- 3.2.4 while嵌套
- 3.2.5 while嵌套案例——打印图形
- 3.2.6 while嵌套案例——九九乘法表
- 3.3 Python的其他语句
- 3.3.1 break语句
- 3.3.2 continue语句
- 3.3.3 pass语句
- 3.3.4 else语句
- 3.4 本章小结
- 3.5 本章习题
- 第4章 字符串
- 4.1 字符串介绍
- 4.1.1 什么是字符串
- 4.1.2 转义字符
- 4.2 字符串的输出和输入
- 4.2.1 字符串输出
- 4.2.2 字符串输入
- 4.3 访问字符串中的值
- 4.3.1 字符串的存储方式
- 4.3.2 使用切片截取字符串
- 4.4 字符串内建函数
- 4.4.1 find
- 4.4.2 index
- 4.4.3 count
- 4.4.4 replace
- 4.4.5 split
- 4.4.6 capitalize
- 4.4.7 title
- 4.4.8 startswith
- 4.4.9 endswith
- 4.4.10 upper
- 4.4.11 ljust
- 4.4.12 rjust
- 4.4.13 center
- 4.4.14 lstrip
- 4.4.15 rstrip
- 4.4.16 strip
- 4.5 字符串运算符
- 4.6 本章小结
- 4.7 本章习题
- 第5章 列表、元组和字典
- 5.1 列表概述
- 5.2 列表的循环遍历
- 5.3 列表的常见操作
- 5.3.1 在列表中增加元素
- 5.3.2 在列表中查找元素
- 5.3.3 在列表中修改元素
- 5.3.4 在列表中删除元素
- 5.3.5 列表的排序操作
- 5.4 列表的嵌套
- 5.4.1 什么是列表的嵌套
- 5.4.2 列表嵌套案例——分配老师到不同的办公室
- 5.5 元组
- 5.6 字典
- 5.6.1 字典介绍
- 5.6.2 字典的常见操作
- 5.6.3 字典的遍历
- 5.7 本章小结
- 5.8 本章习题
- 第6章 Python函数
- 6.1 什么是函数
- 6.2 函数的定义和调用
- 6.2.1 定义函数
- 6.2.2 调用函数
- 6.3 函数的参数
- 6.3.1 函数参数的传递
- 6.3.2 默认参数
- 6.3.3 不定长参数
- 6.4 函数的返回值
- 6.5 函数的四种类型
- 6.5.1 无参数、无返回值的函数
- 6.5.2 无参数、有返回值的函数
- 6.5.3 有参数、无返回值的函数
- 6.5.4 有参数、有返回值的函数
- 6.6 函数案例——名片管理器
- 6.7 函数的嵌套调用
- 6.8 变量作用域
- 6.8.1 LEGB原则
- 6.8.2 全局变量和局部变量
- 6.8.3 global和nonlocal关键字
- 6.9 递归函数和匿名函数
- 6.9.1 递归函数
- 6.9.2 匿名函数
- 6.10 日期时间函数
- 6.10.1 时间函数
- 6.10.2 日历函数
- 6.11 随机数函数
- 6.12 阶段案例——学生管理系统
- 6.13 本章小结
- 6.14 本章习题
- 第7章 高级函数
- 7.1 闭包
- 7.2 装饰器
- 7.2.1 什么是装饰器
- 7.2.2 多个装饰器
- 7.2.3 装饰器对有参数函数进行装饰
- 7.2.4 装饰器对带有返回值的函数进行装饰
- 7.2.5 带有参数的装饰器
- 7.3 常见Python内置函数
- 7.3.1 map函数
- 7.3.2 filter函数
- 7.3.3 reduce函数
- 7.4 本章小结
- 7.5 本章习题
- 第8章 Python文件操作
- 8.1 文件的打开和关闭
- 8.1.1 文件的打开
- 8.1.2 文件模式
- 8.1.3 文件的关闭
- 8.2 文件的读写
- 8.2.1 写文件
- 8.2.2 读文件
- 8.2.3 文件读写应用——制作文件的备份
- 8.2.4 文件的定位读写
- 8.3 文件的重命名和删除
- 8.3.1 文件的重命名
- 8.3.2 文件的删除
- 8.4 文件夹的相关操作
- 8.5 文件操作应用——批量修改文件名
- 8.6 文件案例——学生管理系统(文件版)
- 8.7 本章小结
- 8.8 本章习题
- 第9章 异常
- 9.1 异常简介
- 9.2 异常类
- 9.3 异常处理
- 9.3.1 捕获简单异常
- 9.3.2 捕获多个异常
- 9.3.3 捕获异常的描述信息
- 9.3.4 捕获所有的异常
- 9.3.5 没有捕获到异常
- 9.3.6 终止行为
- 9.4 抛出异常
- 9.4.1 raise语句
- 9.4.2 assert语句
- 9.5 自定义异常
- 9.6 预定义清理
- 9.6.1 with语句
- 9.6.2 上下文管理器
- 9.7 本章小结
- 9.8 本章习题
- 第 10 章 Python模块
- 10.1 模块的基本使用
- 10.2 模块的制作
- 10.3 Python中的包
- 10.4 模块的发布
- 10.5 模块的安装
- 10.6 本章小结
- 10.7 本章习题
- 第 11 章 Python面向对象编程(上)
- 11.1 面向对象编程概述
- 11.2 类和对象
- 11.2.1 类和对象的关系
- 11.2.2 类的定义
- 11.2.3 根据类创建对象
- 11.3 构造方法和析构方法
- 11.3.1 构造方法
- 11.3.2 析构方法
- 11.4 self的使用
- 11.5 运算符重载
- 11.5.1 加法运算符重载
- 11.5.2 索引和分片重载
- 11.5.3 定制对象的字符串形式
- 11.6 阶段案例——反恐精英CS
- 11.7 本章小结
- 11.8 本章习题
- 第 12 章 Python面向对象编程(下)
- 12.1 封装(隐藏数据和保护属性)
- 12.2 继承
- 12.2.1 单继承
- 12.2.2 多继承
- 12.2.3 重写父类方法与调用父类方法
- 12.3 多态
- 12.4 类属性和实例属性
- 12.5 类方法和静态方法
- 12.6 本章小结
- 12.7 本章习题
- 第 13 章 飞机大战
- 13.1 游戏介绍
- 13.1.1 飞机大战游戏简介
- 13.1.2 分析游戏显示的过程
- 13.2 游戏准备工作
- 13.2.1 添加pygame模块
- 13.2.2 搭建游戏界面
- 13.2.3 检查键盘的输入
- 13.3 显示玩家飞机,控制移动方向
- 13.4 玩家飞机发射子弹
- 13.4.1 显示子弹
- 13.4.2 子弹移动
- 13.5 敌人飞机
- 13.5.1 显示敌人飞机
- 13.5.2 控制敌人飞机移动
- 13.5.3 敌人飞机发射子弹
- 13.6 优化程序代码
- 13.6.1 抽取子弹基类
- 13.6.2 抽取飞机基类
- 13.7 本章小结
FAQ
What is the difference between this book and Python Crash Course?
Does the book use Python 2 or Python 3?
Can I find a job just by reading this book?
Comments
Find this book
This site is an index: you start “Search all sources” in your browser, and the entries it lists all point to third-party sites; please judge their availability yourself.
About the author
Heima Programmer is an IT education brand and textbook-writing team under Itcast (Chuanzhi Education), initiated by Zhang Xiaoxiang. It has long focused on developing practical textbooks in areas such as Java, Python, front-end development, and big data, with many of its works published by Posts & Telecom Press. As a collectively credited author, Heima Programmer is not a single individual but a writing team centered on teaching and course development, and its works emphasize hands-on practice and project-driven learning. The library contains 26 of its titles, including representative works such as Software Testing, Modern Methods of Python Programming, Fundamentals of Microservice Architecture (Spring Boot+Spring Cloud+Docker), Java Web Programming Task Tutorial, JavaScript Front-End Development Case Tutorial, Web Design and Production Project Tutorial (HTML+CSS+JavaScript), PHP Basic Case Tutorial, and Java EE Enterprise Application Development Tutorial (Spring+Spring MVC+MyBatis). These works cover categories such as programming design, software learning, computer fundamentals, and examinations. Its writing style relies on cases and task guidance to serve IT learners at both introductory and advanced levels. Public information is limited, so no further biographical details are provided beyond the above.