Python log() 函数
描述
log() 方法返回x的自然对数,x > 0。
语法
以下是 log() 方法的语法:
import math math.log( x )
注意:log()是不能直接访问的,需要导入 math 模块,通过静态对象调用该方法。
参数
- x -- 数值表达式。
返回值
返回x的自然对数,x>0。
实例
以下展示了使用 log() 方法的实例:
#!/usr/bin/python3
import math # 导入 math 模块 print ("math.log(100.12) : ", math.log(100.12))
print ("math.log(100.72) : ", math.log(100.72))
print ("math.log(math.pi) : ", math.log(math.pi))
以上实例运行后输出结果为:
math.log(100.12) : 4.6063694665635735
math.log(100.72) : 4.612344389736092
math.log(math.pi) : 1.1447298858494002
Python log() 函数的更多相关文章
- Python数学函数
1.Python数学函数 1.abs(x):取绝对值,内建函数 2.math.ceil(x):向上取整,在math模块中 3.cmp(x,y):如果 x < y ,返回-1:如果 x == y ...
- python log
python的日志模块为logging,它可以将我们想要的信息输出保存到一个日志文件中. # cat log import logging logging.debug('This is debug m ...
- 第三章:Python基础の函数和文件操作实战
本課主題 Set 集合和操作实战 函数介紹和操作实战 参数的深入介绍和操作实战 format 函数操作实战 lambda 表达式介绍 文件操作函数介紹和操作实战 本周作业 Set 集合和操作实战 Se ...
- python第六天 函数 python标准库实例大全
今天学习第一模块的最后一课课程--函数: python的第一个函数: 1 def func1(): 2 print('第一个函数') 3 return 0 4 func1() 1 同时返回多种类型时, ...
- (转)Python数学函数
原文:https://www.cnblogs.com/lpl1/p/7793645.html PYTHON-基础-内置函数小结----------http://www.wklken.me/posts/ ...
- [Python]返回函数,装饰器拾遗
def lazy_print(*args): def pr(): print(args) return pr 当我们调用lazy_print()时,返回的并不是求和结果,而是求和函数: >> ...
- python 匿名函数&装饰器
匿名函数 关键字lambda表示匿名函数,冒号前面的x表示函数参数匿名函数有个限制,就是只能有一个表达式,不用写return,返回值就是该表达式的结果. >>> list(map(l ...
- 【278】◀▶ Python 数学函数说明
参考:Python 数学函数说明 目录: 一.Python 数学函数 二.Python 随机数函数 三.Python 三角函数 四.Python 数学常量 一.Python 数学函数 函数 返回值 ...
- python中将函数赋值给变量时需要注意的一些问题
python中将函数赋值给变量时需要注意的一些问题 变量赋值是我们在日常开发中经常会遇到的一个问题,本文主要给大家介绍的是关于python将函数赋值给变量时需要注意的一些问题,分享出来供大家参考学习, ...
随机推荐
- Android之属性动画(二)
上一篇文章(链接:http://www.cnblogs.com/jerehedu/p/4458928.html ),我们对属性动画有了简单的认识,并实际动手使用ObjectAnimator.Anim ...
- Android4.2.2 Gallery2源码分析(4)——GLCanvas.java
首先申明,找到这个类是在GLRootView.java中发现的线索.这是一个接口,源码中对该接口作了详细的说明: // // GLCanvas gives a convenient interface ...
- google/protobuf/releases/tag/v3.4.0 下载
Protocol Buffers v3.4.0 Downloads 4.07 MB protobuf-cpp-3.4.0.tar.gz 5.02 MB protobuf-cpp-3.4.0.zip 4 ...
- Could not find com.android.tools.build:gradle:3.0.0-alpha1 in circle ci
Error:(1, 0) The android gradle plugin version 3.0.0-alpha1 is too old, please update to the lates ...
- [Algorithm] Universal Value Tree Problem
A unival tree (which stands for "universal value") is a tree where all nodes under it have ...
- boost::tie()和boost::variant()解说
#include<iostream> #include<boost/tuple/tuple.hpp> #include<boost/variant.hpp> #in ...
- 安装apache+php记录
安装apache yum install httpd 修改apache配置文件,可以修改apache的默认端口号,根目录等 /etc/httpd/conf/httpd.conf 启动/重启apache ...
- hdu4490 Mad Veterinarian(bfs)
Mad Veterinarian Time Limit: 2000/1000 MS (Java/Others) Memory Limit: 32768/32768 K (Java/Others) ...
- 微信小程序 - 各种示例
示例更新(后续持续更新): 最后一次更新:2018-11-7 小程序-地图显示(调用高德地图.腾讯App) - (2018-11-1) 小程序-上传图片(上传.预览.展示.删除) - (2018-11 ...
- 代理(Proxy)模式简介
一.代理(Proxy)模式简介 代理模式是结构型模式. 代理模式给某一个对象提供一个代理对象,并由代理对象控制对原对象的引用. 代理对象要继承于抽象主题,并控制原对象的引用 二.简单例子 抽象主题类 ...