码迷,mamicode.com
首页 > 编程语言 > 详细

Python log10() 函数

时间:2020-07-18 15:45:58      阅读:65      评论:0      收藏:0      [点我收藏+]

标签:class   bin   使用   需要   strong   http   blank   返回   str   

描述

log10() 方法返回以10为基数的x对数。


语法

以下是 log10() 方法的语法:

import math

math.log10( x )

注意:log10()是不能直接访问的,需要导入 math 模块,通过静态对象调用该方法。


参数

  • x -- 数值表达式。

返回值

返回以10为基数的x对数,x>0。高佣联盟 www.cgewang.com


实例

以下展示了使用 log10() 方法的实例:

#!/usr/bin/python
import math   # 导入 math 模块

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 log10() 函数

标签:class   bin   使用   需要   strong   http   blank   返回   str   

原文地址:https://www.cnblogs.com/yc10086/p/13335067.html

(0)
(0)
   
举报
评论 一句话评论(0
登录后才能评论!
© 2014 mamicode.com 版权所有  联系我们:gaon5@hotmail.com
迷上了代码!