Sources — learn-python-basics
取材缓存(2026-06-30)。主题定位:Python 零基础入门,范围限定在运行 Python、基础类型、分支、循环、函数、列表/字典、文本文件读写和一个小 CLI。
S1 — Python Tutorial: Using the Python Interpreter
- URL: https://docs.python.org/3/tutorial/interpreter.html
- 权威: 官方文档
- 支撑: 交互式解释器、提示符、脚本运行入口。
- 关键事实摘录: Python can be used interactively from a prompt, and scripts can be run from files through the interpreter.
S2 — Python Tutorial: An Informal Introduction to Python
- URL: https://docs.python.org/3/tutorial/introduction.html
- 权威: 官方文档
- 支撑: 数字、字符串、列表的入门行为,以及赋值创建名字绑定的直觉。
- 关键事实摘录: the tutorial introduces Python as a calculator, shows strings as sequences, and shows lists as mutable compound data.
S3 — Python Reference: Data model
- URL: https://docs.python.org/3/reference/datamodel.html
- 权威: 官方文档
- 支撑: Python 对象有 identity、type、value;名字绑定对象而不是声明固定盒子。
- 关键事实摘录: objects have identity, type, and value; names refer to objects.
S4 — Python Tutorial: More Control Flow Tools
- URL: https://docs.python.org/3/tutorial/controlflow.html
- 权威: 官方文档
- 支撑:
if、for、range()、break/continue、函数定义和返回值。 - 关键事实摘录: the tutorial defines Python control flow statements and function definitions with
def.
S5 — Python Standard Library: Built-in Types
- URL: https://docs.python.org/3/library/stdtypes.html
- 权威: 官方文档
- 支撑: 真值测试、布尔运算、序列、列表、字典等内建类型行为。
- 关键事实摘录: built-in types include booleans, sequences, lists, mappings, and truth-value testing rules.
S6 — Python Tutorial: Data Structures
- URL: https://docs.python.org/3/tutorial/datastructures.html
- 权威: 官方文档
- 支撑: 列表方法、字典、遍历技巧,以及何时用结构化容器保存多条数据。
- 关键事实摘录: lists support append/remove/sort style operations; dictionaries store key-value pairs.
S7 — Python Tutorial: Input and Output
- URL: https://docs.python.org/3/tutorial/inputoutput.html
- 权威: 官方文档
- 支撑: 格式化输出、读写文件、
with open(...) as f用法和文件对象方法。 - 关键事实摘录: files can be opened with
open(), and usingwithcloses the file after the block finishes.
S8 — Python Tutorial: Errors and Exceptions
- URL: https://docs.python.org/3/tutorial/errors.html
- 权威: 官方文档
- 支撑: 错误信息、异常直觉,以及 CLI 输入转换失败时的最小处理。
- 关键事实摘录: exceptions interrupt normal flow and can be handled with
trystatements.
S9 — Python Standard Library: venv
- URL: https://docs.python.org/3/library/venv.html
- 权威: 官方文档
- 支撑: 虚拟环境的概念和创建命令,作为本课非必要但推荐的环境隔离背景。
- 关键事实摘录:
venvcreates lightweight virtual environments with their own site directories.
S10 — Python Packaging User Guide: Installing packages using pip and virtual environments
- URL: https://packaging.python.org/en/latest/guides/installing-using-pip-and-virtual-environments/
- 权威: 官方文档
- 支撑: 初学者为什么常在虚拟环境中安装第三方包;本课仅使用标准库。
- 关键事实摘录: the guide recommends creating and activating a virtual environment before installing packages with pip.
覆盖核对
1. 运行 Python
- S1 支撑交互模式和脚本;S9/S10 只作环境隔离背景。
2. 变量与类型
- S2 支撑数字、字符串、列表入门;S3 支撑对象/名字模型;S5 支撑内建类型与真值。
3. 分支、循环、函数
- S4 支撑
if、循环、range()、函数和返回值;S5 支撑真值测试。
4. 列表、字典、文件
- S6 支撑列表/字典;S7 支撑输入输出和文件读写。
5. CLI 小项目
- S4/S6/S7/S8 支撑项目所需的流程、数据结构、文件和基础异常处理。