Python log()返回x的自然对数,x>0。
import math math.log( x )
x - 数值表达式。
对于x>0,此方法返回x的自然对数。
以下示例显示了log()方法的用法。
#!/usr/bin/python import math # This will import math module 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)
当无涯教程运行上面的程序时,它产生以下输出-
math.log(100.12) : 4.60636946656 math.log(100.72) : 4.61234438974 math.log(119L) : 4.77912349311 math.log(math.pi) : 1.14472988585
祝学习愉快!(内容编辑有误?请选中要编辑内容 -> 右键 -> 修改 -> 提交!)