Python math.degrees() 方法
定义和用法
math.degrees()
方法将角度从弧度转换为度。
提示:PI(3.14...)弧度等于 180 度,这意味着 1 弧度等于 57.2957795 度。
提示:另请参阅 math.radians(),以将角度值转换为弧度。
实例
将角度从弧度转换为度:
# 导入 math 库 import math # 将角度从弧度转换为度: print (math.degrees(8.90)) print (math.degrees(-20)) print (math.degrees(1)) print (math.degrees(90))
语法
math.degrees(x)
参数
参数 | 描述 |
---|---|
x |
必需。要转换为度的弧度值。 如果参数不是数字,则返回 TypeError。 |
技术细节
返回值: | 表示度数的浮点值。 |
---|---|
Python 版本: | 2.3 |