掃二維碼與項目經(jīng)理溝通
我們在微信上24小時期待你的聲音
解答本文疑問/技術咨詢/運營咨詢/技術建議/互聯(lián)網(wǎng)交流
LOG() 返回 x 的自然對數(shù)。

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

我們在微信上24小時期待你的聲音
解答本文疑問/技術咨詢/運營咨詢/技術建議/互聯(lián)網(wǎng)交流