Python log() 函数
Python 教程
· 2019-02-01 21:29:36
描述
log() 返回 x 的自然对数。
语法
以下是 log() 方法的语法:
import math math.log(x[, base])
注意:log()是不能直接访问的,需要导入 math 模块,通过静态对象调用该方法。
参数
- x -- 数值表达式。
- base -- 可选,底数,默认为 e。
返回值
返回 x 的自然对数,x>0。实例
以下展示了使用 log() 方法的实例:
实例(Python 2.0+)
#!/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)
# 设置底数
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
点击查看所有 Python 教程 文章: https://www.codercto.com/courses/l/8.html
Spring揭秘
王福强 / 人民邮电出版社 / 2009.8 / 99.00元
没有教程似的训导,更多的是说故事般的娓娓道来,本书是作者在多年的工作中积累的第一手Spring框架使用经验的总结,深入剖析了Spring框架各个模块的功能、出现的背景、设计理念和设计原理,揭开了Spring框架的神秘面纱,使你“知其然,更知其所以然”。每部分的扩展篇帮助读者活学活用Spring框架的方方面面,同时可以触类旁通,衍生出新的思路和解决方案。 本书内容全面,论述深刻入理,必将成为每......一起来看看 《Spring揭秘》 这本书的介绍吧!