map() Return an iterator that applies function to every item of iterable, yielding the results 例如: a = map(lambda x:x**2 ,[1,2,3]) print([b for b in a
分类:
编程语言 时间:
2016-03-02 23:31:39
阅读次数:
233
package cn.aust.zyw.demo; import java.util.Iterator; /** * Created by zyw on 2016/2/20. */ public class Stack<Item> implements Iterable<Item>{ private
分类:
其他好文 时间:
2016-02-20 15:50:39
阅读次数:
112
package cn.aust.zyw.demo; import java.util.Iterator; /** * Created by zyw on 2016/2/19. * 用数组实现栈 */ public class MyStack<T> implements Iterable<T>{ pu
分类:
编程语言 时间:
2016-02-19 16:02:42
阅读次数:
195
1.迭代器 names = iter(["alex","jack","rain"]) #声明列表的一个迭代器 names.__next__() #迭代 2.生成器,使用yield后,函数变成一个generator,调用函数返回一个iterable对象 def cash_monkey(amount):
分类:
编程语言 时间:
2016-02-17 22:18:12
阅读次数:
194
pyextend - python extend lib unpack (iterable, count, fill=None) 参数: iterable: 实现 __iter__的可迭代对象, 如 str, tuple, dict, list count: 需要拆分的数量, 如数值大于 len(i
分类:
其他好文 时间:
2016-02-17 12:26:30
阅读次数:
134
集合 13.1 集合的三大类 所有的集合都扩展Iterable特质。集合的三大集合为Seq, Set, Map Seq是一个有先后次序的值的序列,比如数组或列表。IndexSeq允许我们通过整型下表快速访问任意元素。但是链表不可以。 Set是一组没有先后次序的值。SortedSet中,元素排过序。
分类:
其他好文 时间:
2016-02-16 13:30:05
阅读次数:
258
字典的置函数用法(字典dict字典中的key不可以重复)classdict(object):"""dict()->newemptydictionarydict(mapping)->newdictionaryinitializedfromamappingobject‘s(key,value)pairsdict(iterable)->newdictionaryinitializedasifvia:d={}fork,viniterable:d[k]=vdi..
分类:
编程语言 时间:
2016-02-09 01:24:34
阅读次数:
333
1 class set(object): 2 """ 3 set() -> new empty set object 4 set(iterable) -> new set object 5 6 Build an unordered collection of unique elements. 7 "
分类:
编程语言 时间:
2016-02-04 18:51:24
阅读次数:
294
java 集合 java.util包下有两个所有集合的父接口 Collection 和 Map Collection extends自 --java.lang.Iterable接口 其下为: +List 接口 -ArrayList 类 -LinkedList 类 -Vector 类 此类是实现同步的
分类:
编程语言 时间:
2016-01-31 03:11:19
阅读次数:
161
class list(object): """ list() -> new empty list list(iterable) -> new list initialized from iterable's items """ def append(self, p_object): # real s
分类:
编程语言 时间:
2016-01-28 16:38:59
阅读次数:
222