新聞中心
這里有您想知道的互聯(lián)網(wǎng)營銷解決方案
創(chuàng)新互聯(lián)Python教程:pythonlog函數(shù)怎么用
LOG() 返回 x 的自然對數(shù)。

站在用戶的角度思考問題,與客戶深入溝通,找到汶上網(wǎng)站設(shè)計與汶上網(wǎng)站推廣的解決方案,憑借多年的經(jīng)驗,讓設(shè)計與互聯(lián)網(wǎng)技術(shù)結(jié)合,創(chuàng)造個性化、用戶體驗好的作品,建站類型包括:網(wǎng)站制作、成都網(wǎng)站制作、企業(yè)官網(wǎng)、英文網(wǎng)站、手機端網(wǎng)站、網(wǎng)站推廣、域名與空間、網(wǎng)頁空間、企業(yè)郵箱。業(yè)務(wù)覆蓋汶上地區(qū)。
語法
以下是 log() 方法的語法:
import math math.log(x[, base])
相關(guān)推薦:《python視頻教程》
注意:log()是不能直接訪問的,需要導(dǎo)入 math 模塊,通過靜態(tài)對象調(diào)用該方法。
參數(shù)
x -- 數(shù)值表達式。
base -- 可選,底數(shù),默認(rèn)為 e。
返回值
返回 x 的自然對數(shù),x>0。
實例
以下展示了使用 log() 方法的實例:
#!/usr/bin/python # -*- coding: UTF-8 -*- import math # 導(dǎo)入 math 模塊 print "math.log(100.12) : ", math.log(100.12) print "math.log(100.72) : ", math.log(100.72) print "math.log(119L) : ", math.log(119L) print "math.log(math.pi) : ", math.log(math.pi) # 設(shè)置底數(shù) print "math.log(10,2) : ", math.log(10,2)
以上實例運行后輸出結(jié)果為:
math.log(100.12) : 4.60636946656 math.log(100.72) : 4.61234438974 math.log(119L) : 4.77912349311 math.log(math.pi) : 1.14472988585 math.log(10,2) : 3.32192809489
分享名稱:創(chuàng)新互聯(lián)Python教程:pythonlog函數(shù)怎么用
轉(zhuǎn)載來源:http://www.dlmjj.cn/article/djicisg.html


咨詢
建站咨詢
