质量为本、客户为根、勇于拼搏、务实创新
python怎样使用log函数
Python中使用log函数可使用math模块中的log函数。具体用法以下:
import math # 计算以e为底的对数 result = math.log(x) # 计算以指定底数为底的对数 result = math.log(x, base)
其中,x为要计算对数的值,base为指定的底数。如果不指定底数,则默许为e(自然对数)。
x
base
TOP