无涯教程-Python - log10(x)函数

82 阅读1分钟

Python log10(),x>0,返回以10为底的x的对数。

log10(x) - 语法

import math

math.log10( x )

  • x  -  数值表达式。

log10(x) - 返回值

此方法返回x>0的x的以10为底的对数。

log10(x) - 示例

以下示例显示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

参考链接

www.learnfk.com/python/numb…