Python math.e 常量

Python math 模块 Python math 模块

Python math.e 常量用于返回欧拉数 (2.7182...)。

语法

math.e 常量语法如下:

math.e

返回值

返回一个浮点数 2.718281828459045,表示数学常数 e

实例

以下实例返回欧拉数 (2.7182...):

实例

# 导入 math 包
import math

# 输出 e 的值
print (math.e)

输出结果:

2.718281828459045

Python math 模块 Python math 模块