python math.log10()方法,求10为底对数
math.log10()方法
math模块的log10()方法,可以求取以10对底数的对数值,相当于math.log()的第二个参数为10。
log10()语法
log10(x)
python源码对log10()方法的介绍:
Return the base 10 logarithm of x.
参数
参数 | 描述 |
---|---|
x | 必须参数,real number,如int或float等类型 |
提示:如果不传递参数,或参数的值不是real number,python都将抛出TypeError。
返回值
float类型值。
math.log10()方法实例代码
下方实例对比了math.log10()方法和math.log()的一些用法
>>> import math
>>> math.log(10,10)
1.0
>>> math.log10(10)
1.0