摘要: 英文文档: 2. 函数可以接收一个可选的default参数,传入default参数后,如果可迭代对象还有元素没有返回,则依次返回其元素值,如果所有元素已经返回,则返回default指定的默认值而不抛出StopIteration 异常。 阅读全文
posted @ 2017-12-29 16:00 lincappu 阅读(475) 评论(0) 推荐(0) 编辑
摘要: 英文文档: 2. 当传入多个可迭代对象时,函数的参数必须提供足够多的参数,保证每个可迭代对象同一索引的值均能正确传入函数。 3. 当传入多个可迭代对象时,且它们元素长度不一致时,生成的迭代器只到最短长度。 4. map函数是一个典型的函数式编程例子。 阅读全文
posted @ 2017-12-29 15:59 lincappu 阅读(249) 评论(0) 推荐(0) 编辑
摘要: 英文文档: filter(function, iterable) Construct an iterator from those elements of iterable for which function returns true. iterable may be either a seque 阅读全文
posted @ 2017-12-29 15:57 lincappu 阅读(253) 评论(0) 推荐(0) 编辑
摘要: 英文文档: any(iterable) Return True if any element of the iterable is true. If the iterable is empty, return False. Equivalent to: 判断可迭代对象的元素是否有 True值的元素 阅读全文
posted @ 2017-12-29 15:56 lincappu 阅读(273) 评论(0) 推荐(0) 编辑
摘要: 英文文档: all(iterable) Return True if all elements of the iterable are true (or if the iterable is empty). Equivalent to: 判断可迭代对象的每个元素都是 True 值 说明: 1. 接受 阅读全文
posted @ 2017-12-29 15:55 lincappu 阅读(214) 评论(0) 推荐(0) 编辑
摘要: 英文文档: 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 阅读全文
posted @ 2017-12-29 15:53 lincappu 阅读(314) 评论(0) 推荐(0) 编辑
摘要: 英文文档: super([type[, object-or-type]]) Return a proxy object that delegates method calls to a parent or sibling class of type. This is useful for acces 阅读全文
posted @ 2017-12-29 15:52 lincappu 阅读(232) 评论(0) 推荐(0) 编辑
摘要: 英文文档: 根据传入的参数生成一个可切片对象 说明: 1. 函数实际上是一个切片类的构造函数,返回一个切片对象。 2. 切片对象由3个属性start、stop、step组成,start和step默认值为None。切片对象主要用于对序列对象进行切片取对应元素。 3. 对应切片对象的3个属性start、 阅读全文
posted @ 2017-12-29 15:49 lincappu 阅读(451) 评论(0) 推荐(0) 编辑
摘要: 英文文档: iter(object[, sentinel]) Return an iterator object. The first argument is interpreted very differently depending on the presence of the second a 阅读全文
posted @ 2017-12-29 15:48 lincappu 阅读(597) 评论(0) 推荐(0) 编辑
摘要: 英文文档: 根据传入的参数创建一个新的 range 对象 说明: 3. 可以传入一个起始整数和一个结束整数来初始化一个range类型,生成的range类型包含起始整数(包含),和结束整数(不包含)之间的所有整数。 4. 传入了起始整数和结束整数,还可以同时传入一个步进值来初始化一个range类型,生 阅读全文
posted @ 2017-12-29 15:47 lincappu 阅读(662) 评论(0) 推荐(0) 编辑