From 1203a563ff9eb643437e89870ecc66cc42cb0fe1 Mon Sep 17 00:00:00 2001 From: Li-Zhuo-Ran <209094136+Li-Zhuo-Ran@users.noreply.github.com> Date: Fri, 23 Oct 2026 12:58:39 +0800 Subject: [PATCH] Review: python essentials translation --- lectures/python_essentials.md | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/lectures/python_essentials.md b/lectures/python_essentials.md index c8109ff..4c060b7 100644 --- a/lectures/python_essentials.md +++ b/lectures/python_essentials.md @@ -477,7 +477,7 @@ dallas: 1223229 data_file = open('us_cities.txt', 'r') for line in data_file: city, population = line.split(':') # 元组解包 - city = city.title() # 城市名称首字母大写 + city = city.title() # 将城市名称中每个单词的首字母大写 population = f'{int(population):,}' # 为数字添加逗号 print(city.ljust(15) + population) data_file.close() @@ -721,7 +721,7 @@ any([1 <= 2 <= 3, "a" in "letter"]) ```{index} single: Python; Docstrings ``` -Python 有一个为模块、类、函数等添加注释的系统,称为*文档字符串*。 +Python 提供了一种为模块、类、函数等编写说明文档的机制,称为*文档字符串*。 文档字符串的优点在于它们在运行时可用。