Fundamentals of Python Programming
Tags
Summary
Editor's review
As a textbook aimed at readers with no prior background, the book's organization reflects the author's pedagogical wisdom. Rather than rushing to showcase Python's complex features, it begins with the basic thinking of programming and gradually guides readers toward a "problem–algorithm–code" mindset. Most examples are drawn from everyday life and basic mathematics, lowering the barrier to understanding so that readers can focus more on syntax and logic itself. This step-by-step design effectively helps beginners overcome their fear of programming and take a solid first step.
In terms of coverage, the book spans core knowledge including basic Python syntax, the three control structures, functions, lists, and dictionaries, through to file operations and exception handling, forming a fairly complete introductory knowledge system. Its hallmarks are thorough explanations and fully annotated code, making it especially friendly to self-learners. Unlike some introductory books that pursue speed, this one emphasizes steadiness, accurate understanding of concepts, and good coding habits.
Of course, the book's positioning determines its depth. It is an excellent "first book" that builds a solid foundation in syntax and cultivates initial programming thinking, but it touches only lightly on advanced topics such as object-oriented programming, advanced data structures, and popular frameworks. After finishing it, readers need to choose more specialized books for further study according to their direction. Overall, this is a trustworthy introductory guide, especially suited to learners who want to master Python fundamentals systematically and steadily.
Who it's for
A good fit for
- Beginners with no programming experience who want to learn Python systematically from scratch
- Lower-year students in computer science or related majors who need a textbook to accompany their coursework
- Professionals in non-technical roles who want to master automation scripts to improve work efficiency
- People interested in programming who prefer clear, detailed, and gently paced self-study materials
Not a good fit for
- Developers who already have experience with another programming language and want a quick reference for Python syntax
- Readers seeking in-depth coverage of advanced Python features (such as metaprogramming or asynchronous I/O) or popular frameworks
Reading tips
- Hands-on practice is essential. Be sure to type out and run the book's example code line by line in a programming environment while reading, and understand the output.
- The exercises at the end of each chapter are an important way to check your learning; complete them independently, and even when you get stuck, first try thinking it through and searching on your own.
- Keep a code notebook recording concepts that are easy to confuse, common error messages, and their solutions, building your own knowledge base.
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.2 Python的安装
- 1.2.1 Windows环境下安装
- 1.2.2 Linux和UNIX环境下安装
- 本章小结
- 练习题
- 实战作业
- 第2章 基础语法知识
- 2.1 数字和表达式
- 2.2 变量
- 2.3 语句
- 2.4 获取用户输入
- 2.5 函数
- 2.6 模块
- 2.7 程序的运行
- 2.7.1 通过命令提示符运行Python脚本
- 2.7.2 让脚本像普通程序一样运行
- 2.7.3 注释
- 2.8 字符串
- 2.8.1 单引号字符串和转义引号
- 2.8.2 拼接字符串
- 2.8.3 字符串str和repr
- 2.8.4 input
- 2.8.5 长字符串、原始字符串和Unicode
- 本章小结
- 练习题
- 第3章 条件、循环和其他语句
- 3.1 print语句的应用
- 3.2 赋值语句
- 3.2.1 序列解包
- 3.2.2 链式赋值
- 3.2.3 增量赋值
- 3.3 代码块与缩进
- 3.4 条件语句
- 3.4.1 布尔变量
- 3.4.2 if 语句
- 3.4.3 else子句
- 3.4.4 elif子句
- 3.4.5 嵌套条件语句
- 3.5 循环语句
- 3.5.1 while循环
- 3.5.2 for循环
- 3.5.3 Python 循环嵌套
- 3.5.4 跳出循环(break与continue)
- 3.5.5 循环中的else子句
- 3.5.6 综合应用
- 本章小结
- 练习题
- 实战作业
- 第4章 字符串
- 4.1 字符串的基本操作
- 4.1.1 字符串的表示
- 4.1.2 索引
- 4.1.3 分片
- 4.1.4 合并
- 4.1.5 复制
- 4.1.6 截取
- 4.1.7 比较
- 4.1.8 长度与最值
- 4.1.9 in运算符
- 4.2 字符串格式化
- 4.2.1 字符串的格式化输出
- 4.2.2 宽度和精度
- 4.2.3 字符串转义字符
- 4.3 常用字符串函数和方法
- 本章小结
- 练习题
- 实战作业
- 第5章 文件
- 5.1 文件和文件路径
- 5.1.1 os.path.join()和os.mkdir()
- 5.1.2 绝对路径和相对路径
- 5.1.3 查看当前目录os.getcwd()
- 5.1.4 改变当前目录os.chdir()
- 5.1.5 os.remove()及os.rmdir()
- 5.1.6 rename()函数
- 5.1.7 表示当前目录的“。”和表示上级目录的“..”
- 5.1.8 os.walk()方法
- 5.2 文件的读写
- 5.2.1 open()函数
- 5.2.2 read()方法
- 5.2.3 write()方法
- 5.2.4 通用新行格式
- 5.3 文件定位
- 5.3.1 tell()函数
- 5.3.2 seek()函数
- 5.4 文件、目录相关的函数及综合应用示例
- 5.4.1 file对象函数
- 5.4.2 目录常用函数
- 5.4.3 os模块综合应用示例
- 5.5 CSV文件操作
- 5.5.1 CSV模块
- 5.5.2 CSV Reader
- 5.5.3 CSV Writer
- 5.5.4 CSV应用实例
- 本章小结
- 练习题
- 实战作业
- 第6章 列表和元组
- 6.1 序列概览
- 6.2 通用序列操作
- 6.2.1 索引
- 6.2.2 分片
- 6.2.3 列表的运算
- 6.2.4 列表的常用函数
- 6.3 列表对象
- 6.3.1 基本的列表操作
- 6.3.2 列表方法
- 6.3.3 列表解析
- 6.4 元组:不可变序列
- 6.4.1 tuple函数
- 6.4.2 基本元组操作
- 6.4.3 为什么需要元组
- 6.5 列表应用举例:文件分析
- 本章小结
- 练习题
- 实战作业
- 第7章 函数
- 7.1 什么是函数
- 7.2 参数传递
- 7.3 参数的类型
- 7.3.1 必备参数
- 7.3.2 关键字参数
- 7.3.3 默认参数
- 7.3.4 不定长参数
- 7.4 匿名函数
- 7.5 变量作用域
- 7.6 函数的属性
- 7.7 Python中的main函数
- 7.8 Python的zip函数
- 7.9 常见内置函数
- 7.9.1 与数学相关的函数
- 7.9.2 类型转换函数
- 7.9.3 相关操作函数
- 7.10 函数的应用举例
- 本章小结
- 练习题
- 实战作业
- 第8章 字典
- 8.1 什么是字典
- 8.2 字典的创建和使用
- 8.2.1 直接创建字典
- 8.2.2 通过dict函数创建字典
- 8.2.3 字典的修改和删除
- 8.2.4 字典的遍历
- 8.3 字典的基本操作
- 8.3.1 get函数:访问字典成员
- 8.3.2 copy函数:返回一个具有相同键值的新字典
- 8.3.3 pop函数:删除字典中对应的键和值
- 8.3.4 Fromkeys函数:用给定的键建立新的字典
- 8.3.5 setdefault函数:获取与给定键相关联的值
- 8.3.6 update函数:用一个字典更新另外一个字典
- 8.3.7 关键字in的应用
- 8.4 字典的格式化字符串
- 8.5 字典的排序
- 8.5.1 sorted函数按key值对字典排序
- 8.5.2 sorted函数按value值对字典排序
- 8.6 字典的实例应用
- 本章小结
- 练习题
- 实战作业
- 第9章 异常和异常处理
- 9.1 错误与异常
- 9.1.1 语法错误
- 9.1.2 异常
- 9.2 异常处理
- 9.2.1 异常处理语法
- 9.2.2 常见异常处理示例
- 9.3 抛出异常和自定义异常
- 9.3.1 如何抛出异常
- 9.3.2 用户自定义异常
- 本章小结
- 练习题
- 第10章 图形用户界面
- 10.1 丰富的平台
- 10.2 下载和安装wxPython
- 10.3 创建示例GUI应用程序
- 10.3.1 Hello World!
- 10.3.2 窗口
- 10.3.3 控件:面板、标签、菜单栏
- 10.3.4 案例制作:简易编辑器
- 10.3.5 更智能的布局
- 10.3.6 最基本的Sizer:GridSizer
- 10.3.7 FlexGridSizer
- 10.3.8 GridBagSizer
- 10.3.9 BoxSizer
- 10.3.10 StaticBoxSizer
- 10.3.11 案例制作:用户收件信息录入界面
- 10.4 初步了解tkinter
- 本章小结
- 练习题
- 实战作业
- 第11章 面向对象程序设计
- 11.1 面向对象程序设计思想
- 11.1.1 面向对象的基本概念
- 11.1.2 面向对象设计
- 11.2 类和对象
- 11.2.1 创建类
- 11.2.2 创建对象
- 11.3 属性和数据
- 11.3.1 类属性
- 11.3.2 实例属性
- 11.3.3 类属性与实例属性的联系
- 11.3.4 私有属性与公有属性
- 11.3.5 自定义属性
- 11.3.6 self的作用
- 11.4 方法
- 11.4.1 方法的声明和调用
- 11.4.2 实例方法、类方法和静态方法
- 11.4.3 绑定方法和非绑定方法
- 11.4.4 私有方法与公有方法
- 11.4.5 构造方法与析构方法
- 11.4.6 特殊方法
- 11.5 继承
- 11.5.1 概念
- 11.5.2 单继承
- 11.5.3 继承与抽象
- 11.5.4 覆盖方法
- 11.5.5 多重继承
- 11.6 多态和封装
- 11.6.1 多态性
- 11.6.2 封装和私有化
- 11.7 定制类
- 11.8 迭代器
- 11.9 生成器
- 11.10 综合示例
- 本章小结
- 练习题
- 实战作业
- 第12章 数据库支持
- 12.1 数据库概述
- 12.2 Python数据库编程接口(DB-API)
- 12.2.1 DB-API简介与统一操作模式
- 12.2.2 模块接口(Module Interface)
- 12.2.3 Connection对象
- 12.2.4 Cursor游标对象
- 12.3 MySQL关系数据库操作
- 12.3.1 PyMySQL下载与安装
- 12.3.2 PyMySQL基本操作
- 12.4 SQLite数据库与操作
- 12.4.1 SQLite介绍与安装
- 12.4.2 SQLite-Python接口及操作
- 本章小结
- 练习题
- 实战作业
- 第13章 程序开发进阶
- 13.1 简介
- 13.2 分治算法
- 13.3 鸢尾花的分类
- 13.3.1 KNN(K-NearestNeighbor)算法介绍
- 13.3.2 K个最近邻居
- 13.3.3 构造分类样本
- 13.4 设计分类算法
- 13.5 详细设计
- 13.5.1 文件格式
- 13.5.2 存储格式
- 13.5.3 loadDataset函数
- 13.5.4 getNeightbors函数
- 13.5.5 getResponse函数
- 13.5.6 getAccuracy函数
- 13.5.7 总体运行
- 13.5.8 不足之处
- 13.6 其他有趣的算法问题
- 13.6.1 乳腺癌分类问题
- 13.6.2 葡萄酒品质分类
- 本章小结
- 练习题
- 实战作业
FAQ
How much math background does this book require?
What level will I reach after finishing this book?
Is the book's code based on Python 2 or Python 3?
Related on WeRead
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
Cai Yongming is an author with limited publicly available information, and what can currently be verified centers on the book Python Programming Basics. The book falls under programming and design and is an introductory text on the Python language, belonging to the practical teaching materials used in basic computer education. Because reliable records of the author's nationality, dates of birth and death, educational background, professional positions, and English name are not available, no speculation is made here, and no teaching or career experience is invented. Judging from the existing work, Cai Yongming's writing focuses on combining the fundamental concepts and syntax of a programming language with beginner-level exercises, aiming to help newcomers build an overall understanding of Python programming. The style tends toward step-by-step textbook explanation, emphasizing readability and practical operation. This book serves as the main basis for understanding the author's editorial approach, but a single work is not enough to determine the full scope of his writing or influence, and further public information would be needed.
Public information about Xiong Wei is limited, and the available details are not enough to sketch a complete picture of his life or professional identity. Judging from the thirteen works held in the library, his writing and editorial work covers a notably wide range, spanning industrial technology, programming and design, health, examinations, and documentary literature. His representative titles include specialized technical books such as Multi-Sensor Formation Target Tracking Technology, Theoretical Methods and Applications of Electronic Information Equipment System Demonstration, and Core Technologies and Industry Application Practices of the openEuler Operating System; introductory textbooks such as Fundamentals of Python Programming; documentary and popular-science writing such as Only the Yangtze Flows to the Horizon and Space: A Complete Record of Spaceflight; and practical books for everyday use such as Symptomatic Medication and Procurement and Supply Management Practices. Overall, Xiong Wei's writings combine technical depth with knowledge popularization, cover a broad range of subjects, and reach a wide readership.
Public information about Lin Ziyu is limited, and his nationality, dates of birth and death, and educational background cannot currently be confirmed. Judging from the six works held in the library, his writing is aimed mainly at teaching and introductory readers in computer science and data science, covering big data technologies, Spark programming, Python programming, and practical case studies based on Scala. Representative works such as Big Data Technology: Principles and Applications (2nd Edition) and Spark Programming Basics show that he emphasizes combining explanation of principles with hands-on practice: there are both systematic technical overviews and complete case studies on telecom user behavior analysis and movie recommendation systems. His works commonly fall under general computing, examination preparation, and programming design categories, and are suitable for university courses and self-study.