← 返回信息技术目录Python 函数与模块def 定义 · 参数类型 · LEGB 作用域 · 常用标准库
1

函数定义语法

def 函数名(参数):
 return 返回值
2

五种参数类型

位置/关键字/默认
*args / **kwargs
3

LEGB 作用域

L→E→G→B 查找规则
global / nonlocal
4

常用标准库

math / random / time
os / datetime
点击播放或选择步骤