feat(python进阶): 新增模块与包课程
This commit is contained in:
4
02_python进阶/2_1_模块与包/agent_package/__init__.py
Normal file
4
02_python进阶/2_1_模块与包/agent_package/__init__.py
Normal file
@@ -0,0 +1,4 @@
|
||||
# 这个文件表示 agent_package 是一个 Python 包。
|
||||
#
|
||||
# 包就是用于组织多个模块的文件夹。
|
||||
# 目前先保留简单注释,后续课程会继续学习更复杂的包结构。
|
||||
9
02_python进阶/2_1_模块与包/agent_package/status_text.py
Normal file
9
02_python进阶/2_1_模块与包/agent_package/status_text.py
Normal file
@@ -0,0 +1,9 @@
|
||||
# 第 2-1 课示例:包中的模块
|
||||
|
||||
|
||||
def get_status_text(enabled):
|
||||
"""把布尔值状态转换成中文文本。"""
|
||||
if enabled:
|
||||
return "启用"
|
||||
|
||||
return "停用"
|
||||
Reference in New Issue
Block a user