新聞中心
這里有您想知道的互聯(lián)網(wǎng)營銷解決方案
創(chuàng)新互聯(lián)Python教程:Python中degrees怎么用
degrees() 函數(shù)可以將弧度轉(zhuǎn)換為角度。

語法
以下是 degrees() 方法的語法:
import math math.degrees(x)
相關(guān)推薦:《python教程》
注意:degrees() 是不能直接訪問的,需要導(dǎo)入 math 模塊,然后通過 math 靜態(tài)對象調(diào)用該方法。
參數(shù)
x -- 一個數(shù)值。
返回值
返回一個角度值。
實例
以下展示了使用 degrees() 方法的實例:
#!/usr/bin/python import math print "degrees(3) : ", math.degrees(3) print "degrees(-3) : ", math.degrees(-3) print "degrees(0) : ", math.degrees(0) print "degrees(math.pi) : ", math.degrees(math.pi) print "degrees(math.pi/2) : ", math.degrees(math.pi/2) print "degrees(math.pi/4) : ", math.degrees(math.pi/4)
以上實例運行后輸出結(jié)果為:
degrees(3) : 171.887338539 degrees(-3) : -171.887338539 degrees(0) : 0.0 degrees(math.pi) : 180.0 degrees(math.pi/2) : 90.0 degrees(math.pi/4) : 45.0
本文名稱:創(chuàng)新互聯(lián)Python教程:Python中degrees怎么用
本文鏈接:http://fisionsoft.com.cn/article/copsidg.html


咨詢
建站咨詢
