描述
Python數法log10()返回 x > 0 時 x 的以 10 為底的對數。
用法
以下是語法log10()方法 -
import math
math.log10( x )
注意− 此函數不可直接訪問,因此需要導入 math 模塊,然後使用 math 靜態對象調用此函數。
參數
x- 這是一個數字表達式。
返回值
此方法返回 x > 0 時 x 的以 10 為底的對數。
示例
下麵的例子展示了 log10() 方法的用法。
#!/usr/bin/python
import math # This will import math module
print "math.log10(100.12):", math.log10(100.12)
print "math.log10(100.72):", math.log10(100.72)
print "math.log10(119L):", math.log10(119L)
print "math.log10(math.pi):", math.log10(math.pi)
當我們運行上麵的程序時,它會產生以下結果 -
math.log10(100.12): 2.00052084094 math.log10(100.72): 2.0031157171 math.log10(119L): 2.07554696139 math.log10(math.pi): 0.497149872694
相關用法
- Python Number log()用法及代碼示例
- Python Number randrange()用法及代碼示例
- Python Number choice()用法及代碼示例
- Python Number atan2()用法及代碼示例
- Python Number sqrt()用法及代碼示例
- Python Number acos()用法及代碼示例
- Python Number floor()用法及代碼示例
- Python Number asin()用法及代碼示例
- Python Number round()用法及代碼示例
- Python Number shuffle()用法及代碼示例
- Python Number exp()用法及代碼示例
- Python Number cmp()用法及代碼示例
- Python Number max()用法及代碼示例
- Python Number min()用法及代碼示例
- Python Number sin()用法及代碼示例
- Python Number pow()用法及代碼示例
- Python Number uniform()用法及代碼示例
- Python Number ceil()用法及代碼示例
- Python Number cos()用法及代碼示例
- Python Number abs()用法及代碼示例
注:本文由純淨天空篩選整理自 Python Number log10() Method。非經特殊聲明,原始代碼版權歸原作者所有,本譯文未經允許或授權,請勿轉載或複製。