随笔分类 - Python内置函数详解
详解Python的内置函数,使用的是3.5版本
摘要:英文文档: 2. 所有的参数必须是数值类型。 3. 如果x,y有一个是浮点数,则结果将转换成浮点数。 4. 如果x,y都是整数,则结果也是整数,除非y是负数;如果y是负数,则结果返回的是浮点数,浮点数不能取模,所有可选参数z不能传入值。 5. 如果可选参数z传入了值,x,y必须为整数,且y不能为负数
阅读全文
摘要:英文文档: 2. 其功能和chr函数刚好相反。
阅读全文
摘要:英文文档: open(file, mode='r', buffering=-1, encoding=None, errors=None, newline=None, closefd=True, opener=None) Open file and return a corresponding fil
阅读全文
摘要:英文文档: 2. 如果传入参数不是整数,则其必须是一个定义了__index__并返回整数函数的类的实例对象。
阅读全文
摘要:英文文档: class objectReturn a new featureless object. object is a base for all classes. It has the methods that are common to all instances of Python cla
阅读全文
摘要:英文文档: 2. 函数可以接收一个可选的default参数,传入default参数后,如果可迭代对象还有元素没有返回,则依次返回其元素值,如果所有元素已经返回,则返回default指定的默认值而不抛出StopIteration 异常。
阅读全文
摘要:英文文档: min(iterable, *[, key, default]) min(arg1, arg2, *args[, key]) Return the smallest item in an iterable or the smallest of two or more arguments.
阅读全文
摘要:英文文档: class memoryview(obj) 说明: 1. 函数功能返回内存查看对象,实际上是内存查看对象(Momory view)的构造函数。 2. 所谓内存查看对象,是指对支持缓冲区协议的数据进行包装,在不需要复制对象基础上允许Python代码访问。 3. Python内置对象中支持缓
阅读全文
摘要:英文文档: max(iterable, *[, key, default]) max(arg1, arg2, *args[, key]) Return the largest item in an iterable or the largest of two or more arguments. I
阅读全文
摘要:英文文档: 2. 当传入多个可迭代对象时,函数的参数必须提供足够多的参数,保证每个可迭代对象同一索引的值均能正确传入函数。 3. 当传入多个可迭代对象时,且它们元素长度不一致时,生成的迭代器只到最短长度。 4. map函数是一个典型的函数式编程例子。
阅读全文
摘要:英文文档: locals() Update and return a dictionary representing the current local symbol table. Free variables are returned by locals() when it is called i
阅读全文
摘要:英文文档: class list([iterable]) Rather than being a function, list is actually a mutable sequence type, as documented in Lists and Sequence Types — list,
阅读全文
摘要:英文文档: 2. 如果参数为其它类型,则其必须实现__len__方法,并返回整数,否则报错。
阅读全文
摘要:英文文档: iter(object[, sentinel]) Return an iterator object. The first argument is interpreted very differently depending on the presence of the second a
阅读全文
摘要:英文文档: 3. 任何一个类都是自己类的子类,即class和calssinfo传入相同类型时,返回True。 4. 如果classinfo类型对象,是多个类型对象组成的元组,如果class类型对象是元组的任一类型对象的子类,则返回True,否则返回False。 5. 如果classinfo类型对象,
阅读全文
摘要:英文文档: isinstance(object, classinfo) Return true if the object argument is an instance of the classinfo argument, or of a (direct, indirect or virtual)
阅读全文
摘要:英文文档: class int(x=0) class int(x, base=10) Return an integer object constructed from a number or string x, or return 0 if no arguments are given. If x
阅读全文
摘要:英文文档: input([prompt]) If the prompt argument is present, it is written to standard output without a trailing newline. The function then reads a line f
阅读全文
摘要:英文文档: hex(x) Convert an integer number to a lowercase hexadecimal string prefixed with “0x”, for example If x is not a Python int object, it has to de
阅读全文