Python math.radians() 方法
实例
将不同的度转换为弧度:
# 导入 math 库import math# 将不同的度转换为弧度print(math.radians(180))print(math.radians(100.03))print(math.radians(-20))
定义与用法
math.radians() 方法将度值转换为弧度。
提示:另请参见 math.degrees() 将角度从弧度转换为度。
语法
math.radians(x)
参数值
| 参数 | 描述 |
|---|---|
| x | 必填。要转换为弧度的度数值。如果参数不是数字,则返回 TypeError |
技术细节
| 返回值: | 一个 float 值,表示角度的弧度值 |
|---|---|
| Python 版本: | 2.0 |