Share E-Book
Scan to open this page

Scan with your phone to open this page

Author: Eric Matthes

本书是一本针对所有层次的Python读者而作的Python入门书。全书分两部分:首部分介绍用Python 编程所必须了解的基本概念,包括matplotlib、NumPy和Pygal等强大的Python库和工具介绍,以及列表、字典、if语句、类、文件与异常、代码测试等内容;第二部分将理论付诸实践,讲解如何开发三个项目,包括简单的Python 2D游戏开发,如何利用数据生成交互式的信息图,以及创建和定制简单的Web应用,并帮读者解决常见编程问题和困惑。

AI Reading Assistant

Whole-book reading guide from stratified index samples; jump to passages in the text

AI guide
【One-Line Pitch】 A hands-on, project-driven introduction to Python that takes you from your first `print()` to a playable 2D game, data visualizations, and a deployed web app. Best for absolute beginners and self-taught learners who want to build real, finished projects rather than just study syntax. 【Book Arc】 - **Opening (~0%–13%)**: Environment setup and core syntax — installing Python on Linux/OS X/Windows, choosing an editor, and writing the first program. Solves the "I don't know where to start" problem. - **Early (~13%–33%)**: Fundamental data structures and control flow — variables, strings, numbers, lists, tuples, `if` statements, dictionaries, `input()` and `while` loops. Builds the vocabulary for everything later. - **Middle (~33%–47%)**: Abstraction and robustness — functions, classes and inheritance, reading/writing files, exceptions, storing data with JSON, and writing tests with `unittest`. This is the bridge from beginner to intermediate. - **Late (~47%–67%)**: Project 1, *Alien Invasion* — a Pygame-based 2D shooter covering sprites, collision detection, scoring, levels, and refactoring into modules. - **Late (~67%–80%)**: Project 2, data visualization — matplotlib line/scatter plots, Pygal histograms and world maps, CSV and JSON parsing, and pulling live data from web APIs like GitHub and Hacker News. - **Ending (~80%–100%)**: Project 3, the "Learning Log" Django web app — models, URLs, views, templates, user accounts, Bootstrap styling, and deployment to Heroku, plus appendices on Git, editors, and getting help. 【Key Takeaways】 - **Setup is treated as a first-class chapter** (Opening): the book walks through Python 2 vs. 3, per-OS installation, and editor configuration, so beginners aren't blocked before writing code. - **Data structures are the backbone of Part 1** (Early): lists, tuples, and dictionaries are taught with practical operations — slicing, sorting, nesting, and iteration — rather than abstract definitions. - **Functions and classes are introduced as reusability tools** (Middle): you learn to package logic into named blocks and model real-world objects, which is the conceptual leap from scripting to structured programs. - **Error handling and testing are not afterthoughts** (Middle): `try-except`, `FileNotFoundError`, JSON persistence, and `unittest` appear before the projects, so later code is written defensively. - **Projects are sequenced by difficulty** (Late): a game teaches event loops and collision logic; visualization teaches data pipelines; the web app teaches full-stack CRUD and deployment. - **Refactoring is modeled explicitly** (Late): the game project repeatedly splits growing code into modules like `settings.py` and `game_functions.py`, showing how real projects stay maintainable. - **External data is a core skill** (Late): CSV, JSON, and REST API consumption are all covered, connecting Python to the wider data ecosystem. - **Deployment closes the loop** (Ending): the Django project ends with Heroku deployment, `requirements.txt`, `Procfile`, and security settings — turning a local exercise into a live application. 【Reading Tips】 - **Deep-read Part 1 chapters 2–11** if you're new to programming; the pacing is deliberately gentle and skipping risks gaps in lists, classes, or exceptions that the projects assume. - **Skim the per-OS setup sections** (Linux/OS X/Windows) and read only the one matching your machine — the other two are redundant for you. - **Do the projects in order** even though the author says they're independent; the game builds comfort with larger files, which makes the Django project less intimidating. - **Type every code example by hand** rather than copying — the book's value is in the debugging muscle you build when your output doesn't match. - **Treat the appendices as reference**, not reading material: Git, editor setup, and "getting help" are best consulted when you actually hit a wall. 【Coverage Limits】 This guide is based on stratified excerpts covering the table of contents, front matter, and setup chapters; the detailed content of the project chapters and later appendices is summarized from chapter listings rather than full text, so specific code walkthroughs are not reproduced here.
Excerpt 1
2.2 检查是否相等时不考虑大小写 5.2.3 检查是否不相等 5.2.4 比较数字 5.2.5 检查多个条件 5.2.6 检查特定值是否包含在列表中 5.2.7 检查特定值是否不包含在列表中 5.2.8 布尔表达式 5.3 if语句 5.3.1 简单的if语句 5.3.2 if-else语句 5.3.3 if-...
View in text
Excerpt 2
botron设置主页的样式 20.1.5 设置登录页面的样式 20.1.6 设置new_topic页面的样式 20.1.7 设置topics页面的样式 20.1.8 设置topic页面中条目的样式 20.2 部署“学习笔记” 20.2.1 建立Heroku账户 20.2.2 安装Heroku Toolbelt 2...
View in text
Excerpt 3
含多个难度不断增加的等级。完成这个项目后,你就能够自己动手开发2D游戏了。 第二个项目(第15~17章)介绍数据可视化。数据科学家的目标是通过各种可视化技术来搞懂海量信息。你将使用通过代码生成的数据集、已经从网络下载下来的数据集以及程序自动下载的数据集。完成这个项目后,你将能够编写能对大型数据集进行筛选的程序,并...
View in text
Excerpt 4
h code: 0) Press return to continue 如果没有看到这样的输出,请检查你输入的每个字符。你是不是将 print 的首字母大写了?是不是遗漏了引号或括号?编程语言对语法的要求非常严格,只要你没有严格遵守语法,就会出错。如果代码都正确,这个程序也不能正确地运行,请参阅1.3节。 4....
View in text
Excerpt 5
n 3.5.0 (v3.5.0:374f501f4567, Sep 13 2015, 22:15:05) [MSC v.1900 32 bit (Intel)] on win32 Type "help", "copyright", "credits" or "license" for more informati...
View in text
Excerpt 6
时,解释器就会将括号中的内容打印到屏幕,而不会管括号中的内容是什么。 编写程序时,编辑器会以各种方式突出程序的不同部分。例如,它知道 print 是一个函数的名称,因此将其显示为蓝色;它知道“Hello Python world!”不是Python代码,因此将其显示为橙色。这种功能称为 语法突出 ,在你刚开始编写...
View in text
Excerpt 7
y的第2行存在错误(见❶);它列出了这行代码,旨在帮助你快速找出错误(见❷);它还指出了它发现的是什么样的错误(见❸)。在这里,解释器发现了一个名称错误,并指出打印的变量 mesage 未定义:Python无法识别你提供的变量名。名称错误通常意味着两种情况:要么是使用变量前忘记了给它赋值,要么是输入变量名时拼写不...
View in text
Tags
AI categories
PythonProgrammingEducation
python
ISBN: 7115428026
Publish Year: 2016
Language: Chinese
File Format: EPUB
File Size: 3.5 MB