Python Quick Programming Primer cover

Python Quick Programming Primer

Rating 3.7
Word count
98K words
Chapters
264
ISBN
9787115458360

Tags

Summary

Python is an object-oriented, interpreted high-level programming language that has been applied in numerous fields, including web development, operating system management, automation scripts for server operations, scientific computing, desktop software, server software (network software), and games. Using Windows as the platform, this book provides a systematic and comprehensive introduction to the fundamentals of Python 3. Chapter 1 helps readers get to know Python; Chapter 2 explains Python's basic syntax; Chapter 3 introduces commonly used statements in Python; Chapters 4–5 cover types such as strings, lists, tuples, and dictionaries; Chapters 6–7 explain the fundamentals and advanced knowledge of functions; Chapter 8 covers file operations in Python; Chapter 9 explains exception handling in Python; Chapter 10 introduces modules in Python; Chapters 11–12 focus on object-oriented programming concepts; and Chapter 13 applies object-oriented programming ideas to develop a small airplane shooter game. The book comes with accompanying videos, source code, exercises, and teaching slides. To help beginners better grasp the content, online Q&A is also provided, and we hope to attract more readers. This book can serve as a textbook for programming courses in undergraduate and associate degree programs in computer-related majors at colleges and universities, as well as a training textbook for Python programming fundamentals. It is an introductory textbook suitable for beginners in programming and development.

Editor's review

Python Fast-Track Programming Primer is written by Heima Programmers, a well-known domestic IT training institution, and published by Posts & Telecom Press. With a clear positioning, this book is an introductory tutorial for programming learners starting from zero. Compared with the many Python introductory books on the market, its notable features are its clear structure, plain language, and its complete orientation around beginners' cognitive path, avoiding getting bogged down in complex concepts too early. The content follows a progressive logic of "basic syntax–core concepts–typical applications," covering key knowledge points from variables, data types, and flow control to functions, file operations, and even object-oriented programming, and introduces simple cases from practical fields such as web scraping and data analysis at appropriate points, aiming to spark interest in learning and build initial confidence in "learning to apply."\n\nAs a product of a training institution, the book inevitably bears the marks of being "practice-driven" and "quick to get started," which is both an advantage and something readers should view dialectically. The advantage is that it strips away redundant theoretical buildup and goes straight to how to write runnable code, making it very friendly to self-learners eager to see results quickly. However, this arrangement to some extent sacrifices depth and breadth of the knowledge system, with relatively limited discussion of programming paradigms, underlying principles, and best practices. Therefore, the book is more like a carefully polished "key" that can efficiently help you open the door to the Python world, but the vast world beyond the door requires readers to explore through more systematic project practice or advanced reading after completing this book. Overall, this is a qualified "from 0 to 1" guidebook, especially suitable for beginners who need a clear learning path and immediate positive feedback.

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

  1. 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.
  2. 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.
  3. 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 China · Founded in 1953

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. 版权信息
  2. 内容提要
  3. 序言
  4. 前言
  5. 第1章 Python概述
  6. 1.1 认识Python
  7. 1.1.1 Python的发展历程
  8. 1.1.2 Python的特点
  9. 1.1.3 Python的应用领域
  10. 1.1.4 Python的版本
  11. 1.1.5 Python 2.x和Python 3.x版本区别
  12. 1.2 Python安装
  13. 1.2.1 Windows安装Python开发环境
  14. 1.2.2 Linux安装Python开发环境
  15. 1.2.3 Mac OS安装Python开发环境
  16. 1.3 IPython——交互式解释器
  17. 1.4 集成开发环境——PyCharm
  18. 1.4.1 PyCharm的下载安装
  19. 1.4.2 PyCharm的使用
  20. 1.5 Python程序执行原理
  21. 1.6 本章小结
  22. 1.7 本章习题
  23. 第2章 Python基础语法
  24. 2.1 基本语法
  25. 2.1.1 注释
  26. 2.1.2 行与缩进
  27. 2.1.3 语句换行
  28. 2.2 变量和数据类型
  29. 2.2.1 变量和赋值
  30. 2.2.2 变量的类型
  31. 2.3 标识符和关键字
  32. 2.3.1 标识符
  33. 2.3.2 关键字
  34. 2.4 简单数值类型
  35. 2.4.1 整型
  36. 2.4.2 浮点型
  37. 2.4.3 布尔类型
  38. 2.4.4 复数类型
  39. 2.4.5 数字类型转换
  40. 2.5 运算符
  41. 2.5.1 算术运算符
  42. 2.5.2 赋值运算符
  43. 2.5.3 复合赋值运算符
  44. 2.5.4 比较运算符
  45. 2.5.5 逻辑运算符
  46. 2.5.6 成员运算符
  47. 2.6 位运算
  48. 2.6.1 按位左移
  49. 2.6.2 按位右移
  50. 2.6.3 按位与
  51. 2.6.4 按位或
  52. 2.6.5 按位异或
  53. 2.6.6 按位取反
  54. 2.7 运算符优先级
  55. 2.8 本章小结
  56. 2.9 本章习题
  57. 第3章 Python常用语句
  58. 3.1 判断语句
  59. 3.1.1 if语句
  60. 3.1.2 if-else语句
  61. 3.1.3 if-elif语句
  62. 3.1.4 if嵌套
  63. 3.1.5 if案例——猜拳游戏
  64. 3.2 循环语句
  65. 3.2.1 while循环
  66. 3.2.2 for循环
  67. 3.2.3 while循环案例——计算 1~100 偶数和
  68. 3.2.4 while嵌套
  69. 3.2.5 while嵌套案例——打印图形
  70. 3.2.6 while嵌套案例——九九乘法表
  71. 3.3 Python的其他语句
  72. 3.3.1 break语句
  73. 3.3.2 continue语句
  74. 3.3.3 pass语句
  75. 3.3.4 else语句
  76. 3.4 本章小结
  77. 3.5 本章习题
  78. 第4章 字符串
  79. 4.1 字符串介绍
  80. 4.1.1 什么是字符串
  81. 4.1.2 转义字符
  82. 4.2 字符串的输出和输入
  83. 4.2.1 字符串输出
  84. 4.2.2 字符串输入
  85. 4.3 访问字符串中的值
  86. 4.3.1 字符串的存储方式
  87. 4.3.2 使用切片截取字符串
  88. 4.4 字符串内建函数
  89. 4.4.1 find
  90. 4.4.2 index
  91. 4.4.3 count
  92. 4.4.4 replace
  93. 4.4.5 split
  94. 4.4.6 capitalize
  95. 4.4.7 title
  96. 4.4.8 startswith
  97. 4.4.9 endswith
  98. 4.4.10 upper
  99. 4.4.11 ljust
  100. 4.4.12 rjust
  101. 4.4.13 center
  102. 4.4.14 lstrip
  103. 4.4.15 rstrip
  104. 4.4.16 strip
  105. 4.5 字符串运算符
  106. 4.6 本章小结
  107. 4.7 本章习题
  108. 第5章 列表、元组和字典
  109. 5.1 列表概述
  110. 5.2 列表的循环遍历
  111. 5.3 列表的常见操作
  112. 5.3.1 在列表中增加元素
  113. 5.3.2 在列表中查找元素
  114. 5.3.3 在列表中修改元素
  115. 5.3.4 在列表中删除元素
  116. 5.3.5 列表的排序操作
  117. 5.4 列表的嵌套
  118. 5.4.1 什么是列表的嵌套
  119. 5.4.2 列表嵌套案例——分配老师到不同的办公室
  120. 5.5 元组
  121. 5.6 字典
  122. 5.6.1 字典介绍
  123. 5.6.2 字典的常见操作
  124. 5.6.3 字典的遍历
  125. 5.7 本章小结
  126. 5.8 本章习题
  127. 第6章 Python函数
  128. 6.1 什么是函数
  129. 6.2 函数的定义和调用
  130. 6.2.1 定义函数
  131. 6.2.2 调用函数
  132. 6.3 函数的参数
  133. 6.3.1 函数参数的传递
  134. 6.3.2 默认参数
  135. 6.3.3 不定长参数
  136. 6.4 函数的返回值
  137. 6.5 函数的四种类型
  138. 6.5.1 无参数、无返回值的函数
  139. 6.5.2 无参数、有返回值的函数
  140. 6.5.3 有参数、无返回值的函数
  141. 6.5.4 有参数、有返回值的函数
  142. 6.6 函数案例——名片管理器
  143. 6.7 函数的嵌套调用
  144. 6.8 变量作用域
  145. 6.8.1 LEGB原则
  146. 6.8.2 全局变量和局部变量
  147. 6.8.3 global和nonlocal关键字
  148. 6.9 递归函数和匿名函数
  149. 6.9.1 递归函数
  150. 6.9.2 匿名函数
  151. 6.10 日期时间函数
  152. 6.10.1 时间函数
  153. 6.10.2 日历函数
  154. 6.11 随机数函数
  155. 6.12 阶段案例——学生管理系统
  156. 6.13 本章小结
  157. 6.14 本章习题
  158. 第7章 高级函数
  159. 7.1 闭包
  160. 7.2 装饰器
  161. 7.2.1 什么是装饰器
  162. 7.2.2 多个装饰器
  163. 7.2.3 装饰器对有参数函数进行装饰
  164. 7.2.4 装饰器对带有返回值的函数进行装饰
  165. 7.2.5 带有参数的装饰器
  166. 7.3 常见Python内置函数
  167. 7.3.1 map函数
  168. 7.3.2 filter函数
  169. 7.3.3 reduce函数
  170. 7.4 本章小结
  171. 7.5 本章习题
  172. 第8章 Python文件操作
  173. 8.1 文件的打开和关闭
  174. 8.1.1 文件的打开
  175. 8.1.2 文件模式
  176. 8.1.3 文件的关闭
  177. 8.2 文件的读写
  178. 8.2.1 写文件
  179. 8.2.2 读文件
  180. 8.2.3 文件读写应用——制作文件的备份
  181. 8.2.4 文件的定位读写
  182. 8.3 文件的重命名和删除
  183. 8.3.1 文件的重命名
  184. 8.3.2 文件的删除
  185. 8.4 文件夹的相关操作
  186. 8.5 文件操作应用——批量修改文件名
  187. 8.6 文件案例——学生管理系统(文件版)
  188. 8.7 本章小结
  189. 8.8 本章习题
  190. 第9章 异常
  191. 9.1 异常简介
  192. 9.2 异常类
  193. 9.3 异常处理
  194. 9.3.1 捕获简单异常
  195. 9.3.2 捕获多个异常
  196. 9.3.3 捕获异常的描述信息
  197. 9.3.4 捕获所有的异常
  198. 9.3.5 没有捕获到异常
  199. 9.3.6 终止行为
  200. 9.4 抛出异常
  201. 9.4.1 raise语句
  202. 9.4.2 assert语句
  203. 9.5 自定义异常
  204. 9.6 预定义清理
  205. 9.6.1 with语句
  206. 9.6.2 上下文管理器
  207. 9.7 本章小结
  208. 9.8 本章习题
  209. 第 10 章 Python模块
  210. 10.1 模块的基本使用
  211. 10.2 模块的制作
  212. 10.3 Python中的包
  213. 10.4 模块的发布
  214. 10.5 模块的安装
  215. 10.6 本章小结
  216. 10.7 本章习题
  217. 第 11 章 Python面向对象编程(上)
  218. 11.1 面向对象编程概述
  219. 11.2 类和对象
  220. 11.2.1 类和对象的关系
  221. 11.2.2 类的定义
  222. 11.2.3 根据类创建对象
  223. 11.3 构造方法和析构方法
  224. 11.3.1 构造方法
  225. 11.3.2 析构方法
  226. 11.4 self的使用
  227. 11.5 运算符重载
  228. 11.5.1 加法运算符重载
  229. 11.5.2 索引和分片重载
  230. 11.5.3 定制对象的字符串形式
  231. 11.6 阶段案例——反恐精英CS
  232. 11.7 本章小结
  233. 11.8 本章习题
  234. 第 12 章 Python面向对象编程(下)
  235. 12.1 封装(隐藏数据和保护属性)
  236. 12.2 继承
  237. 12.2.1 单继承
  238. 12.2.2 多继承
  239. 12.2.3 重写父类方法与调用父类方法
  240. 12.3 多态
  241. 12.4 类属性和实例属性
  242. 12.5 类方法和静态方法
  243. 12.6 本章小结
  244. 12.7 本章习题
  245. 第 13 章 飞机大战
  246. 13.1 游戏介绍
  247. 13.1.1 飞机大战游戏简介
  248. 13.1.2 分析游戏显示的过程
  249. 13.2 游戏准备工作
  250. 13.2.1 添加pygame模块
  251. 13.2.2 搭建游戏界面
  252. 13.2.3 检查键盘的输入
  253. 13.3 显示玩家飞机,控制移动方向
  254. 13.4 玩家飞机发射子弹
  255. 13.4.1 显示子弹
  256. 13.4.2 子弹移动
  257. 13.5 敌人飞机
  258. 13.5.1 显示敌人飞机
  259. 13.5.2 控制敌人飞机移动
  260. 13.5.3 敌人飞机发射子弹
  261. 13.6 优化程序代码
  262. 13.6.1 抽取子弹基类
  263. 13.6.2 抽取飞机基类
  264. 13.7 本章小结

FAQ

What is the difference between this book and Python Crash Course?
Both are excellent introductory books. Python Fast-Track Programming Primer focuses more on quickly organizing and getting started with syntax knowledge, with a compact pace, and its cases tend to be demonstrative; Python Crash Course is longer and more comprehensive, with complete project practice in the second half (such as games and data visualization), offering deeper guidance and suitable for readers with more time who want to build a more solid foundation in one go.
Does the book use Python 2 or Python 3?
This book is written based on Python 3, in line with current technology trends. The syntax and libraries involved in the book can all run normally in a Python 3 environment.
Can I find a job just by reading this book?
No. The core goal of this book is to help readers build basic awareness and fundamental skills in Python programming. To reach job-ready level, you need to, on the basis of this book, deeply study data structures and algorithms, the frameworks and ecosystems of at least one specialized direction (such as web development, data analysis, or automated operations), and accumulate considerable project experience. This book is the first step in a long journey.

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.

More by the same author

Top rated in the same category