math.radians(x)

本页内容
上一节: Ref_math_prod 下一节: Ref_math_remainder

Python math.radians() 方法

Python math 模块

Python math.radians(x) 方法将角度 x 从度数转换为弧度。

math.degrees() 方法将弧度值转换为度数。

Python 版本: 2.0

语法

math.radians() 方法语法如下:


示例

math.radians(x)

参数说明:

  • x -- 必需,数字。如果 x 不是一个数字,返回 TypeError。

返回值

返回一个浮点数,表示弧度值。

==

以下实例返回不同度数转换为弧度:


示例

# 导入 math 包

import math

# 输出度数转换为弧度

print(math.radians(180))

print(math.radians(100.03))

print(math.radians(-20))

输出结果:


示例

3.141592653589793
1.7458528507699278
-0.3490658503988659

Python math 模块

上一节: Ref_math_prod 下一节: Ref_math_remainder
此页面最后编辑于2022年8月17日 (星期三) 21:52。