Note You will get ValueError if you pass a negative number to the method.
Here we are going to learn about the different log functions of math modules with examples in Python. Python offers many inbuild logarithmic functions under the module math which allows us to compute logs using a single lineThere are 4 variants of logarithmic functions all of which are discussed in this article. Import math mathlogx base 注意log是不能直接访问的需要导入 math 模块通过静态对象调用该方法 参数 x -- 数值表达式 base -- 可选底数默认为 e 0. The mathlog number Base method is used to compute the logarithm of any Base.