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://codercto.com/courses/l/8.html
解构产品经理:互联网产品策划入门宝典
电子工业出版社 / 2018-1 / 65
《解构产品经理:互联网产品策划入门宝典》以作者丰富的职业背景及著名互联网公司的工作经验为基础,从基本概念、方法论和工具的解构入手,配合大量正面或负面的案例,完整、详细、生动地讲述了一个互联网产品经理入门所需的基础知识。同时,在此基础上,将这些知识拓展出互联网产品策划的领域,融入日常工作生活中,以求职、沟通等场景为例,引导读者将知识升华为思维方式。 《解构产品经理:互联网产品策划入门宝典》适合......一起来看看 《解构产品经理:互联网产品策划入门宝典》 这本书的介绍吧!