英文文档:

min(iterable*[, keydefault])

min(arg1arg2*args[, key])

Return the smallest item in an iterable or the smallest of two or more arguments.

If one positional argument is provided, it should be an iterable. The smallest item in the iterable is returned. If two or more positional arguments are provided, the smallest of the positional arguments is returned.

There are two optional keyword-only arguments. The key argument specifies a one-argument ordering function like that used for list.sort(). The default argument specifies an object to return if the provided iterable is empty. If the iterable is empty and default is not provided, a ValueError is raised.

If multiple items are minimal, the function returns the first one encountered. This is consistent with other sort-stability preserving tools such as sorted(iterable, key=keyfunc)[0] and heapq.nsmallest(1, iterable, key=keyfunc).

说明:

  

  1. 函数功能为取传入的多个参数中的最小值,或者传入的可迭代对象元素中的最小值。默认数值型参数,取值小者;字符型参数,取字母表排序靠前者。还可以传入命名参数key,其为一个函数,用来指定取最小值的方法。default命名参数用来指定最小值不存在时返回的默认值。功能与max函数相反。

  2. 函数至少传入两个参数,但是有只传入一个参数的例外,此时参数必须为可迭代对象,返回的是可迭代对象中的最小元素。

参考 max 函数

Python内置函数(4)——min的更多相关文章

  1. Python内置函数(43)——min

    英文文档: min(iterable, *[, key, default]) min(arg1, arg2, *args[, key]) Return the smallest item in an ...

  2. Python之路(第八篇)Python内置函数、zip()、max()、min()

    一.python内置函数 abs() 求绝对值 例子 print(abs(-2)) all() 把序列中每一个元素做布尔运算,如果全部都是true,就返回true, 但是如果是空字符串.空列表也返回t ...

  3. Python之路Python内置函数、zip()、max()、min()

    Python之路Python内置函数.zip().max().min() 一.python内置函数 abs() 求绝对值 例子 print(abs(-2)) all() 把序列中每一个元素做布尔运算, ...

  4. python 内置函数和函数装饰器

    python内置函数 1.数学相关 abs(x) 取x绝对值 divmode(x,y) 取x除以y的商和余数,常用做分页,返回商和余数组成一个元组 pow(x,y[,z]) 取x的y次方 ,等同于x ...

  5. Python 内置函数笔记

    其中有几个方法没怎么用过, 所以没整理到 Python内置函数 abs(a) 返回a的绝对值.该参数可以是整数或浮点数.如果参数是一个复数,则返回其大小 all(a) 如果元组.列表里面的所有元素都非 ...

  6. 【转】python 内置函数总结(大部分)

    [转]python 内置函数总结(大部分) python 内置函数大讲堂 python全栈开发,内置函数 1. 内置函数 python的内置函数截止到python版本3.6.2,现在python一共为 ...

  7. python内置函数,匿名函数

    一.匿名函数 匿名函数:为了解决那些功能很简单的需求而设计的一句话函数 def calc(n): return n**n print(calc(10)) #换成匿名函数 calc = lambda n ...

  8. python 内置函数总结(大部分)

    python 内置函数大讲堂 python全栈开发,内置函数 1. 内置函数 python的内置函数截止到python版本3.6.2,现在python一共为我们提供了68个内置函数.它们就是pytho ...

  9. Python内置函数之匿名(lambda)函数

    Python内置函数之匿名(lambda)函数 作者:尹正杰 版权声明:原创作品,谢绝转载!否则将追究法律责任. 一.匿名函数 #!/usr/bin/env python #_*_coding:utf ...

随机推荐

  1. angular路由详解五(辅助路由)

    在HTML文件中 //主路由 <router-outlet></router-outlet> //辅助路由 <router-outlet  name="aux& ...

  2. 对JS prototype的理解

    1.什么是prototype? function F() {} f1 = new F();f2 = new F(); 以上的代码,F()是一个构造函数,f1和f2是由这个构造函数产生的对象. prot ...

  3. 关于win系统下Anaconda与TensorFlow的安装相关事宜以及错误:ImportError: No module named 'tensorflow'的解决

    1.安装TensorFlow之前应该先安装Anaconda,不需要安装python,否则会出问题,我安装的版本是Anaconda3-4.2.0-Windows-x86_64,在这个链接上可以找到--h ...

  4. tp框架的MVC模式

    一.定义 MVC全名是Model View Controller,是模型(model)-视图(view)-控制器(controller)的缩写,一种软件设计典范,用一种业务逻辑.数据.界面显示分离的方 ...

  5. 使用python读取word,写入execl

    word里面有2张表,需要找到第二张表,并写入execl中: 代码如下: #coding:utf-8 import os from docx import Document import win32c ...

  6. Linux find用法

    Linux中find常见用法示例 ----摘抄哪里忘记了 ·find   path   -option   [   -print ]   [ -exec   -ok   command ]   {} ...

  7. Python爬取百度贴吧

    from urllib import request,parseimport os#找到借口及关键字base_url = 'http://tieba.baidu.com/f?'a = input(&q ...

  8. 搭建hadoop伪分布式环境

    伪分布式就是只有一台机器,既是namenode又是datanode.一台阿里云服务器(centos)即可完成. Java环境 首先需要安装Java环境,下载jdk的安装包,解压到/usr/java/, ...

  9. 解决NSURLConnection finished with error - code -1100错误

    更新到xcode9以后,拖进工程中一个html文件,webview加载这个文件,xcode一直抛出 NSURLConnection finished with error - code -1100异常 ...

  10. 关于Unity中如何代码动态修改天空盒

    在Unity中动态修改天空盒有两种方法: 一.为每个Texture建立天空盒材质球,需要更换时直接将对应材质球作为天空盒,缺点是建立的材质球太多 private void ChangeSkybox(M ...